Navicat连接mysql报错1251解决方案
- 现象:Navicat连接mysql报错1251“Client does not support the authentication protocol requested by the server”
- **问题原因:**mysql8.1使用的插件plugin为caching_sha2_password
命令行登录mysql,查看用户所有插件:
select host,user,plugin,authentication_string from mysql.user;
从MySQL5.7.5开始,默认的认证插件从mysql_native_password变更为caching_sha2_password,这可能会导致一些旧的客户端或库无法正确连接到服务器,尤其是那些还没有更新以支持新认证协议的。
- 解决方案:将对应登录用户的插件改成mysql_native_password即可
1)修改用户对应插件
Alter user 'root'@'localhost' identified with mysql_native_password by 'rootpassword';
# 其中 root为登录用户,localhost为登录主机IP,rootpassword为root用户对应密码
2)刷新权限
flush privileges;
3)再次查看插件
4)修改成功,测试连接