centos下mysql密码忘记修改办法

1.关闭正在运行的 MySQL :

#service mysql stop

接着运行

#mysqld_safe --skip-grant-tables &

2.使用mysql连接server:

#mysql -p

3.更改密码:

mysql> update mysql.user set authentication_string=password('123') where user='root' and Host = 'localhost';

 

*特别提醒注意的一点是,新版的mysql数据库下的user表中已经没有Password字段了,而是将加密后的用户密码存储于authentication_string字段

4.刷新使立即生效

mysql> flush privileges;
mysql> quit;

5.重启

#service mysql restart

 

posted on 2017-09-26 17:31  pandexiong  阅读(121)  评论(0)    收藏  举报