1. 程式人生 > 實用技巧 >Navicat連線mysql報錯 1251 - Client does not support authentication protocol requested by server

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)


重新連線,一切正常