mysql5.5 单实例找回密码

1.停止mysql
/etc/init.d/mysqld stop
2.使用--skip-grant-tables 启动mysql ,忽略授权登录认证
mysqld_safe --skip-grant-tables --user=mysql &
mysql -u root -p 

提示:在启动时加--skip-grant-tables 参数,表示忽略授权表验证



登录后
update mysql.user set password=password('newpassword') where user='root' and host='localhost';
flush privileges;

这种方式启动mysql没有pid文件,故停止不能用/etc/init.d/mysqld stop 这种方法

用这种方法停止:
mysqladmin -u root -p '123456' shutdown 


再用正常的方法启动即可

 

posted @ 2017-04-27 23:18  shijiu520  阅读(93)  评论(0)    收藏  举报