连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv...

昨天在自己的远程服务器上玩,把系统重装了。新装了MySQL,在本地用navicat连接的时候出了几个小问题。

问题一:SSH: expected key exchange group packet from server

连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv..._第1张图片连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv..._第2张图片

这个问题在网上查了查说是navicat自己的问题,升级版本就好了。没管那么多,在SSH选项卡里把使用ssh通道取消了,使用常规连接。

问题二:2003 - Can't connect to MySQL server on 'XXX' (10038)

连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv..._第3张图片

第一个问题刚解决,但是第二个问题又出来了,这个问题是我忘了设置MySQL允许远程访问

解决方法是将bind-address = 127.0.0.1注释掉

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

在bind-address = 127.0.0.1这句的前面加上#

问题三:1130 - Host 'XXX' is not allowed to connect to this MySQL server

连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv..._第4张图片

前面两个问题本以为这就好了,结果又报了个这,看意思是我的IP没有权限。在网上查了查,找到了一个解决办法:修改MySQL的用户表

1、登录mysql

mysql -u root -p

2、查看一下用户表

use mysql
select host,user from user;

连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv..._第5张图片

3、修改host字段

根据查到的结果可以发现只有本机可以访问,我的做法是把host字段改成%

update user set host = '%' where user = 'root';

连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv..._第6张图片

4、刷新MySQL的系统权限相关表

flush privileges;­

再次远程连接数据库成功

连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv..._第7张图片

 

几经转折,才连接上(╯‵□′)╯︵┴─┴

转载于:https://www.cnblogs.com/weiyalin/p/9282192.html

你可能感兴趣的:(连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL serv...)