背景
…
问题现象
Navicat连接MySQL时报错,如下:
Client does not support authentication protocol requested by server; consider upgrading MySQL client
问题分析
是由于Navicat版本太低的问题,出现连接失败的原因:mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password。有两种解决方案:①升级Navicat(Navicat是收费项目,不推荐);②手头修改MySQL的加密规则为:mysql_native_password;这里采用第二种方案(耗时3~5分钟)。
解决方案
#登录MySQL
mysql -uroot -p
#选择数据库
use mysql;
#修改加密规则
alter user `root`@`localhost` identified with mysql_native_password by '12345678';
#刷新权限,使自己的修改生效
flush privileges;
之后,即可成功连接Navicat。