连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL server on 'XXX' (10038) / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

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

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

连接远程数据库时出现 SSH: expected key exchange group packet from server  / 2003 - Can't connect to MySQL server on 'XXX' (10038)  / 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 server on 'XXX' (10038)  / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

这个问题在网上查了查说是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 server on 'XXX' (10038)  / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

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

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

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

连接远程数据库时出现 SSH: expected key exchange group packet from server  / 2003 - Can't connect to MySQL server on 'XXX' (10038)  / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

在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 server on 'XXX' (10038)  / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

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

1、登录mysql

mysql -u root -p

连接远程数据库时出现 SSH: expected key exchange group packet from server  / 2003 - Can't connect to MySQL server on 'XXX' (10038)  / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

2、查看一下用户表

use mysql
select host,user from user;

连接远程数据库时出现 SSH: expected key exchange group packet from server  / 2003 - Can't connect to MySQL server on 'XXX' (10038)  / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

3、修改host字段

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

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

连接远程数据库时出现 SSH: expected key exchange group packet from server  / 2003 - Can't connect to MySQL server on 'XXX' (10038)  / 1130 - Host 'XXX' is not allowed to connect to this MySQL server

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

flush privileges;­

连接远程数据库时出现 SSH: expected key exchange group packet from server  / 2003 - Can't connect to MySQL server on 'XXX' (10038)  / 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 server on 'XXX' (10038)  / 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 server on 'XXX' (10038)  / 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 server on 'XXX' (10038)  / 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 server on 'XXX' (10038)  / 1130 - Host 'XXX' is not allowed to connect to this MySQL server
上一篇:WinForm c# 备份 还原 数据库(Yc那些事儿 转)


下一篇:Python深度学习案例2--新闻分类(多分类问题)