无法连接到' x.x.x.x'上的MySQL服务器(110)

时间:2018-01-04 22:19:19

标签: mysql centos6

你好我在MySQL上有一个问题我无法远程连接到它,我已经找到了这里发布的答案,但它们都不适合我!

这是我尝试连接到mysql时的错误消息

$> mysql -u user01 -h x.x.x.x -p
  • ERROR 2003(HY000):无法在&x; x.x.x.x'上连接到MySQL服务器(110)

的Telnet

[root@machine2 ~]# telnet x.x.x.x 3306
Trying x.x.x.x...
telnet: connect to address x.x.x.x: Connection timed out

这是IPTABLES文件

#Generated by iptables-save v1.4.7 on Thu Jan  4 21:58:18 2018
    *filter
    :INPUT ACCEPT [56:6256]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [35:3538]
    -A INPUT -p tcp -m tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT 
    -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT 
    -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT 
    -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT 
    -A INPUT -i lo -p tcp -m tcp --dport 3306 -j ACCEPT 
    -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT 
    -A OUTPUT -p tcp -m tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT 
    COMMIT
#Completed on Thu Jan  4 21:58:18 2018

- 我已经创建了一个用户

CREATE USER 'user' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON *.* TO 'user';
FLUSH PRIVILEGES;

这是my.cnf个文件

#For advice on how to change settings please see
#http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
port=3306
skip-name-resolve
skip-external-locking
innodb_buffer_pool_size=3G



#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

和我的端口3306已经打开

[root@localhost ~]# netstat -petulan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       User       Inode      PID/Program name
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      0          12889      2056/rpcbind
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      0          13930      2441/sshd
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      0          13141      2133/cupsd
tcp        0      0 0.0.0.0:32895               0.0.0.0:*                   LISTEN      29         12977      2078/rpc.statd
tcp        0      0 x.x.x.x:22           x.x.x.x:49964        ESTABLISHED 0          7891927    4453/sshd
tcp        0     64 x.x.x.x:22           x.x.x.x:50203        ESTABLISHED 0          7892871    4482/sshd
tcp        0      0 :::3306                     :::*                        LISTEN      27         7896831    6648/mysqld
tcp        0      0 :::111                      :::*                        LISTEN      0          12892      2056/rpcbind

这里有什么问题吗?谢谢!

我正在使用 CentOS 6.9

0 个答案:

没有答案