Navicat MySQL连接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。 

 

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 '123456' with grant option;  

 

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

 

 

原文:http://database.51cto.com/art/201108/282334.htm

原文地址:https://www.cnblogs.com/qingxuan/p/3254825.html