配置 Mybatis 环境时, 连接 mysql 出现下面错误:
1 Client does not support authentication protocol requested by server; consider upgrading MySQL client
通过网上如下方法, 恢复成功:
(1)Windows 系统中, 使用 cmd 连接 mysql 数据库.
mysql -h localhost -u root -p mysql
(2) 输入数据库密码, 登录成功后, 执行如下语句后问题解决:
- use mysql;
- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpwd';
- FLUSH PRIVILEGES;
其中第二句中, root 是用户名, localhost 是数据库地址, newpwd 是新密码.
来源: http://www.bubuko.com/infodetail-2639677.html