报错信息
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage:
'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
sqlState: '08004',
fatal: true
即客户端不支持认证协议?考虑升级 mysql 客户端?
原因是因为Mysql 版本太新,MySQL8.0版本的加密方式和MySQL5.0的不一样,连接会报错。
解决办法
登陆数据库
mysql -u root -p
更改mysql 加密方式
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
更新密码
mysql>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';
刷新
mysql> FLUSH PRIVILEGES;
验证
msyql server is connecting...