系统环境
阿里云主机。
Ubuntu:20.04
MySQL。
情况
想用 navicat 远程连接 MySQL 服务器,但是出现了 Client does not support authentication protocol requested by server。
问题的原因是使用了新的加密方式导致。
解决方法:修改 MySQL 的密码方式
进入 MySQL
mysql -uroot -p
选择 mysql 表
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select user,host,plugin from user where user='zhouyi';
+--------+------+-----------------------+
| user | host | plugin |
+--------+------+-----------------------+
| zhouyi | % | caching_sha2_password |
+--------+------+-----------------------+
1 row in set (0.00 sec)
如上所示,使用 caching_sha_password。
更改
mysql> alter user 'zhouyi'@'%' identified by '这里是你的密码' password expire never;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,plugin from user where user='zhouyi';
+--------+------+-----------------------+
| user | host | plugin |
+--------+------+-----------------------+
| zhouyi | % | caching_sha2_password |
+--------+------+-----------------------+
1 row in set (0.00 sec)
mysql> alter user 'zhouyi'@'%' identified with mysql_native_password by '这里是你的密码';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> select user,host,plugin from user where user='zhouyi';
+--------+------+-----------------------+
| user | host | plugin |
+--------+------+-----------------------+
| zhouyi | % | mysql_native_password |
+--------+------+-----------------------+
1 row in set (0.00 sec)
如上所示,密码改为了 native_password。
这样问题解决。