无法通过外部网络ip连接到mysql

时间:2015-05-15 06:18:17

标签: mysql

我正在使用CentOS 6.5 64位和mysql-server-5.5.43-29.el6.art.x86_64 外部网络IP地址为118.192.87.188

第一

vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
:wq

第二

yum -y install mysql mysql-server
/etc/init.d/mysqld start
chkconfig mysqld on
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

第三

mysql_secure_installation
    .......
"Thanks for using MySQL!"

阐述:

/etc/init.d/mysqld restart

第五:

mysql -uroot -ppasswd -P3306
mysql>use mysql;
mysql>select user,host from user;
mysql>update user set host='%' where user='root';
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'passwd' WITH GRANT OPTION;
mysql>flush privileges;

问题: 我可以使用:

连接到这个CentOS中的mysql
mysql -uroot -ppasswd -P3306
mysql -uroot -ppasswd -hlocalhost -P3306
mysql -uroot -ppasswd -h127.0.0.1 -P3306
mysql -uroot -ppasswd -h118.192.87.188 -P3306

但在我的Ubuntu中:

mysql -uroot -ppasswd -h118.192.87.188 -P3306

30秒后:

  

ERROR 2003(HY000):无法连接到'118.192.87.188'上的MySQL服务器(110)

0 个答案:

没有答案
相关问题