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
posted @ 2021-03-27 15:24  jongty  阅读(2773)  评论(0编辑  收藏  举报