美文网首页
重置MySQL密码

重置MySQL密码

作者: 挨踢的懒猫 | 来源:发表于2017-06-12 08:41 被阅读45次

停止MySQL服务

service mysqld stop

启动mysqld_safe ,跳过启动授权表。

启动时加上skip-grant-tables参数目的是在启动MySQL时不启动grant-tables,授权表。这样就可以修改root的密码了。

 mysqld_safe --skip-grant-tables &

登录MySQL,重置密码

mysql -uroot -p  //直接回车,不输入密码
use mysql;
update user set authentication_string=PASSWORD('12345678') where user="root";  
//注意老版本的mysql是password字段
 flush privileges;
 quit;

相关文章

网友评论

      本文标题:重置MySQL密码

      本文链接:https://www.haomeiwen.com/subject/bmokqxtx.html