帮助中心

linux系统云主机如何重设mysql密码?

2012/12/10 11:09:15

先结束mysql进程 #killall mysqld
用mysql安全模式运行并跳过权限 #mysqld_safe –skip-grant-tables 用root登录,此时不需要密码 #mysql –u root
现在开始重设密码 #mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with –A
Database changed
Mysql> upsate user set Password=new password where user = ‘root’ ;
Query OK, 2 rows affected (0.02 sec)
Rows matched: 2 Changed: 2 Warnings: 0
Mysql> quit
重新启动mysql服务 #service mysqld restart