1.进入容器
docker exec -it xxxx bash
2.使用root账号登录mysql
mysql -u root -p
3.查看当前加密方式
use mysql;
SELECT Host, User, plugin from user;
我这是改过了,应该都是caching_sha2_password
4. 修改加密方式
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
5.刷新权限
6.查看是否修改成功
SELECT Host, User, plugin from user;