Navicat连接mysql报错 1251 - Client does not support authentication protocol requested by server;

Navicat连接mysql报错 1251 - Client does not support authentication protocol requested by server;


新装了一台mysql8.0的数据库,用navicat连接时报错,原因是版本问过底导致的这个错误
可以用新版本,不行的话可以试试下面的方法

如下图所示:

寻找原因

mysql> select user,host,plugin from user where user='root';
+------+-----------+-----------------------+
| user | host      | plugin                |
+------+-----------+-----------------------+
| root | %         | caching_sha2_password |
| root | localhost | mysql_native_password |
+------+-----------+-----------------------+
2 rows in set (0.00 sec)

解决方案

修改plugin字段为mysql_native_password

mysql> alter user 'root'@'%' identified with mysql_native_password by 'you password';
Query OK, 0 rows affected (0.27 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


mysql> select user,host,plugin from user where user='root';
+------+-----------+-----------------------+
| user | host      | plugin                |
+------+-----------+-----------------------+
| root | %         | mysql_native_password |
| root | localhost | mysql_native_password |
+------+-----------+-----------------------+
2 rows in set (0.01 sec)


重新连接,一切正常

posted @ 2020-12-29 17:02  EverEternity  阅读(330)  评论(0编辑  收藏  举报