select user,host,plugin,authentication_string from user; update user set host = '%' where user = 'root'; flush privileges;2.修改账号密码
select user,host,plugin,authentication_string from user; ALTER USER 'root'@'%' IDENTIFIED WITH caching_sha2_password BY '123'; 如果所有的plugin字段都是统一的可以直接使用,否则使用上面的明确指定 ALTER user 'root'@'localhost' IDENTIFIED BY 'root';3.显示grant-tables问题
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
使用以下指令
flush privileges;4.显示1045(28000)问题
1 在 /usr/local/mysql/conf.d目录下增加文件: my.cnf 具体目录根据你在使用docker 配置的目录而决定
[mysqld] skip-grant-tables
然后重启 docker容器
5.如果你只是写了这些内容,你会发现无法连接Mysql "Lost connection to MySQL server at ‘reading initial communication packet', system error: 0
或者
Mysql "Lost connection to MySQL server at ‘reading initial communication packet', system error: 0
在你修改密码成功后,一定要删除 并且重启 docker容器



