Navicat连接centos6.5报错2003和1130

1、在w7上安装centos6.5虚拟机,通过yum安装mysql。

2、在w7上用Navicat连接虚拟机上的mysql时报错2003:Can't connect to MySQL server (10060)

3、需要关闭centos6.5的防火墙,有两种方式:

①临时关闭防火墙服务

service iptables stop

②开机不再启动防火墙服务

chkconfig iptables off

4、之后用Navicat连接虚拟机上的mysql时又报错1130 host 192.168.1.100 is not allowed to connect to this MySql server

5、在安装mysql的虚拟机登入mysql账号(楼主此处使用secureCRT登入虚拟机执行下边命令),更改 "mysql" 数据库里的 "user" 表

里的 "host" 项,把原来的"localhost"改成"%"即可解决。

mysql -uroot -p password

mysql>use mysql;

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

mysql>select host, user from user;

mysql>flush privileges或mysql>service mysqld restart生效以上设置