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";

原文地址:https://www.cnblogs.com/st666/p/10132452.html