Mysql8 SqlState 08004 解决方法

1,725 阅读1分钟

环境

容器:docker 18.09.2

镜像:mysql 8.0.16

连接方式:Navicat Premium 12.1.23

错误日志

parent: {"code":"ER_NOT_SUPPORTED_AUTH_MODE","errno":1251,"sqlState":"08004","sqlMessage":"Client does not support authentication protocol requested by server; consider upgrading MySQL client"}
original: {"code":"ER_NOT_SUPPORTED_AUTH_MODE","errno":1251,"sqlState":"08004","sqlMessage":"Client does not support authentication protocol requested by server; consider upgrading MySQL client"}
pid: 2005

解决方法

step 1

mysql -u root -p

step 2

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
SELECT plugin FROM mysql.user WHERE User = 'root';