Navicat MySQL连接Linux下MySQL的问题解决方案

Navicat for MySQL Enterprise Edition 8.1.18注册码:NAVE-WAGB-ZLF4-T23K 使用Navicat连接Linux 下的MySQL遇到的问题。

Error1: 2003:Can't connect to MySQL server on 'localhost'

解决方法:

关闭Linux的防火墙功能,或者设置容许TCP协议的3306端口通过,可以下使用如下命令开启TCP协议的3306端口。

  1. [root@bugzilla ~]# more /etc/sysconfig/iptables。  
  2.  
  3. -A RH-Firewall-1-INPUT -p tcp --dport 3306 -j ACCEPT。 

以下是我试过的,错误是10038

一.can‘t connect to MySql server on ‘192.168.X.X’

这是因为mysql端口被防火墙拦截,需用linux执行如下指令:

1.#/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

2.#/etc/rc.d/init.d/iptables save

3.#/etc/init.d/iptables restart

4.查看端口是否开启#/etc/init.d/iptables status

Error2: 1130 - Host'ClientIP' is not allowed to connect to this MySQL server。

解决方法:

使用root 用户登陆Linux,登陆MySQL的root用户,更改容许登陆的IP地址范围。

  1. [root@bugzilla ~]# mysql -u root -p  
  2.  
  3. mysql>grant all privileges on *.* to 'root'@'%' identified by '密码' with grant option;  

这段指令容许所有用root用户输入密码登陆该mysql server,如果将'%' 换成'192.168.1.100' ,那么只有'192.168.1.100'的主机可以登陆。

关于Navicat MySQL连接Linux下的MySQL数据库的知识就介绍到这里了,希望本次的介绍能够对您有所收获!

原文地址:https://www.cnblogs.com/weiyiyong/p/7638083.html