Navicat远程连接不上mysql解决方案

 

一.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

二.1130-host ... is not allowed to connect to this MySql server

方法一:

mysql -u root -p password>use mysql;

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

mysql>FLUSH   PRIVILEGES;

mysql>select host, user from user;

方法二:

1) 从任何主机连接到mysql服务器

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

2)只允许用户root从ip为192.168.x.x的主机连接到mysql服务器,并使用password作为密码

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.x.x' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

如果你想允许用户root从ip为192.168.x.x'的主机连接到mysql服务器的某个数据库,并使用password作为密码

GRANT ALL PRIVILEGES ON 数据库名.* TO 'root'@'192.168.x.x' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

一.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

二.1130-host ... is not allowed to connect to this MySql server

方法一:

mysql -u root -p password>use mysql;

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

mysql>FLUSH   PRIVILEGES;

mysql>select host, user from user;

方法二:

1) 从任何主机连接到mysql服务器

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

2)只允许用户root从ip为192.168.x.x的主机连接到mysql服务器,并使用password作为密码

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.x.x' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

如果你想允许用户root从ip为192.168.x.x'的主机连接到mysql服务器的某个数据库,并使用password作为密码

GRANT ALL PRIVILEGES ON 数据库名.* TO 'root'@'192.168.x.x' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH   PRIVILEGES;

上一篇:System Verilog MCDF(二)


下一篇:MySql常用命令集Mysql常用命令5