环境:MAC Docker
, Windows10 Docker
Mysql版本:8.0.19
启动命令:docker run -p 3307:3306 --name 8mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:latest
Navicat:11.0.19
现象:
Client does not support authentication protocol requested by server; consider upgrading MySQL client
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
flush privileges;
In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password.
mysql8.0以后, 默认加密plugin,是caching_sha2_password
。
需要改为Navi cat支持的mysql_native_password
。
mysql -u root -p
use mysql;
select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| % | root | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | caching_sha2_password |
+-----------+------------------+-----------------------+
执行完后:
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| % | root | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | mysql_native_password |
+-----------+------------------+-----------------------+
6.4.1.2 Caching SHA-2 Pluggable Authentication
caching_sha2_password as the Preferred Authentication Plugin