当我们用Navicat连接MySQL时,会报这样的错误:
这是由于新版本的MySQL使用的是caching_sha2_password验证方式。但此时的navicat还没有支持这种验证方式。
解决方法就是将验证方式改为以前版本(5.7及以下)使用的验证方式mysql_native_password。
1、查看MySQL的验证方式
mysql> select user,plugin from user where user='root';
如果plugin为caching_sha2_password则证明我们需要更改它的验证方式
2、如何更改
mysql> select user,host from user;
- 如果host如图一样为‘%’
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码';
- 如果host为’localhost’
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';
3、
密码为在MySQL中设置的密码