Docker下MySQL忘记密码解决方法

1.设置无密码登陆:

vim /etc/mysql/conf.d/docker.cnf

加上skip-grant-tables,这样不需要密码可以直接以root身份登录,然后重设密码

2、重置密码:

use mysql; update mysql.user set authentication_string=password('root') where User='root';

3、刷新权限:

flush privileges;

4、将配置信息该回1中截图所示
5、重启MySQL5、重启MySQL
慢慢来才是最快的
原文地址:https://www.cnblogs.com/jongty/p/14585899.html