MySQL忘记密码怎么办

1. 关闭正在运行的MySQL服务
2. vim /etc/my.cnf
添加skip-grant-tables
启动mysql
3. 登录
mysql -uroot
use mysql;
update mysql.user set authentication_string=password('qwert123456') where user='root';
flush privileges;
quit
mysql5.7以下版本:
改密码:update user set password=password("root") where user="root";

posted @ 2018-12-17 16:55  知者认知  阅读(131)  评论(0编辑  收藏  举报