Client does not support authentication protocol requested by server,Consider upgrading mysql client
一、直接安装的mysql服务端
#1.通过命令行进入解压的mysql根目录下
#2.登陆数据库
mysql -u root -p
#3.输入密码
Enter password: ******
#4.更改加密方式(原样拷贝到命令窗中)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
#5.更改密码:该例子中 123456为新密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
#6.刷新配置:
mysql> FLUSH PRIVILEGES;
二、Docker镜像容器下的mysql服务端
#1.通过命令行进入docker容器
docker exec -it 容器id bash
#2.登陆数据库
root@ae09d792ef0e:/# mysql -u root -p
#3.输入密码
Enter password: ******
#4.输入命令
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
#5.刷新配置:
mysql> FLUSH PRIVILEGES;