mysql密码丢失时恢复密码的方法
mysql密码丢失时恢复密码的方法1)不用密码登录
# mysql
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
显示错误,说明密码已经修改。
修改方法:
Unix&Linux:
1.用root或者运行mysqld的用户登录系统;
2.利用kill命令结束掉mysqld的进程;
3.使用--skip-grant-tables参数启动MySQL Server
shell>;mysqld_safe --skip-grant-tables &(写全路径)
4.为root@localhost设置新密码
shell>;mysqladmin -u root flush-privileges password \"newpassword\",或直接进入mysql表中修改Password
如:
>;use mysql
>;update user set password=password(\"new_pass\"where user=\"root\";
>;flush privileges;
5.重启MySQL Server
Windows:
1.用系统管理员登陆系统。
2.停止MySQL的服务。
3.进入命令窗口,然后进入MySQL的安装目录,比如我的安装目录是c:\\mysql,进入C:\\mysql\\bin
4.跳过权限检查启动MySQL,
c:\\mysql\\bin>;mysqld-nt --skip-grant-tables
5.重新打开一个窗口,进入c:\\mysql\\bin目录,设置root的新密码
c:\\mysql\\bin>;mysqladmin -u root flush-privileges password \"newpassword\"
c:\\mysql\\bin>;mysqladmin -u root -p shutdown
将newpassword替换为你要用的root的密码,第二个命令会提示你输入新密码,重复第一个命令输入的密码。
6.停止MySQL Server,用正常模式启动Mysql
7.你可以用新的密码链接到Mysql了。
2)用修改后的密码登录
# mysql -u root -p
Enter password: (输入修改后的密码123456)
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 4 to server version: 4.0.16-standard
Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.
mysql>
成功!
这是通过mysqladmin命令修改口令,也可通过修改库来更改口令。
mysql密码丢失时恢复密码的方法
mysql密码丢失时恢复密码的方法1)不用密码登录
# mysql
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
显示错误,说明密码已经修改。
修改方法:
Unix&Linux:
1.用root或者运行mysqld的用户登录系统;
2.利用kill命令结束掉mysqld的进程;
3.使用--skip-grant-tables参数启动MySQL Server
shell>;mysqld_safe --skip-grant-tables &(写全路径)
4.为root@localhost设置新密码
shell>;mysqladmin -u root flush-privileges password \"newpassword\",或直接进入mysql表中修改Password
如:
>;use mysql
>;update user set password=password(\"new_pass\"where user=\"root\";
>;flush privileges;
5.重启MySQL Server
Windows:
1.用系统管理员登陆系统。
2.停止MySQL的服务。
3.进入命令窗口,然后进入MySQL的安装目录,比如我的安装目录是c:\\mysql,进入C:\\mysql\\bin
4.跳过权限检查启动MySQL,
c:\\mysql\\bin>;mysqld-nt --skip-grant-tables
5.重新打开一个窗口,进入c:\\mysql\\bin目录,设置root的新密码
c:\\mysql\\bin>;mysqladmin -u root flush-privileges password \"newpassword\"
c:\\mysql\\bin>;mysqladmin -u root -p shutdown
将newpassword替换为你要用的root的密码,第二个命令会提示你输入新密码,重复第一个命令输入的密码。
6.停止MySQL Server,用正常模式启动Mysql
7.你可以用新的密码链接到Mysql了。
2)用修改后的密码登录
# mysql -u root -p
Enter password: (输入修改后的密码123456)
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 4 to server version: 4.0.16-standard
Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.
mysql>
成功!
这是通过mysqladmin命令修改口令,也可通过修改库来更改口令。
mysql密码丢失时恢复密码的方法
mysql密码丢失时恢复密码的方法1)不用密码登录
# mysql
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
显示错误,说明密码已经修改。
修改方法:
Unix&Linux:
1.用root或者运行mysqld的用户登录系统;
2.利用kill命令结束掉mysqld的进程;
3.使用--skip-grant-tables参数启动MySQL Server
shell>;mysqld_safe --skip-grant-tables &(写全路径)
4.为root@localhost设置新密码
shell>;mysqladmin -u root flush-privileges password \"newpassword\",或直接进入mysql表中修改Password
如:
>;use mysql
>;update user set password=password(\"new_pass\"where user=\"root\";
>;flush privileges;
5.重启MySQL Server
Windows:
1.用系统管理员登陆系统。
2.停止MySQL的服务。
3.进入命令窗口,然后进入MySQL的安装目录,比如我的安装目录是c:\\mysql,进入C:\\mysql\\bin
4.跳过权限检查启动MySQL,
c:\\mysql\\bin>;mysqld-nt --skip-grant-tables
5.重新打开一个窗口,进入c:\\mysql\\bin目录,设置root的新密码
c:\\mysql\\bin>;mysqladmin -u root flush-privileges password \"newpassword\"
c:\\mysql\\bin>;mysqladmin -u root -p shutdown
将newpassword替换为你要用的root的密码,第二个命令会提示你输入新密码,重复第一个命令输入的密码。
6.停止MySQL Server,用正常模式启动Mysql
7.你可以用新的密码链接到Mysql了。
2)用修改后的密码登录
# mysql -u root -p
Enter password: (输入修改后的密码123456)
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 4 to server version: 4.0.16-standard
Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.
mysql>
成功!
这是通过mysqladmin命令修改口令,也可通过修改库来更改口令。
页:
[1]