1. Network detection
1) Ping the host can;
2) Telnet host 3306 port can not;
Telnet host 22 port can be;
The description is not related to the native network;
2. Port detection
1) netstat-ntpl |grep 3306
TCP 0 0::: 3306:::* LISTEN-
2) Netstat-ntpl |grep 22
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN-
You can see that port 22 listens to all addresses, and 3,306 listens to native addresses (bound to local), so it cannot be accessed remotely. Modify MY.CNF in bind-address=0.0.0.0
For ports that only allow native access, there are two places enabled, one is firewall enabled 3306, and the other is MySQL configuration binds the machine address.
3. Firewall detection
1) iptables--list view;
2) Open firewall 3306 port
Vi/etc/sysconfig/iptables
-A input-m state–state new-m tcp-p tcp–dport 3306-j ACCEPT (Allow 3306 ports through the firewall)
/etc/init.d/iptables Restart (Restart the firewall for configuration to take effect)
3) or close the firewall directly; Reference: http://blog.csdn.net/fjssharpsword/article/details/50973283
CentOS 7 is modified after firewall
Systemctl Start Firewalld# Start,
Systemctl enable FIREWALLD # boot up
Systemctl Stop Firewalld # off
Systemctl Disable FIREWALLD # Cancel boot boot
4. mysql configuration file check
Check the configuration of the MY.CNF, BIND-ADDRESS=ADDR can configure the binding IP address.
No configuration or IP configuration of 0.0.0.0 indicates that all client connections are listening.
#ps-aux | grep mysql view process ID is 3340
#ll/proc/3340 See the process program, find the configuration file
Or #which MySQL to find the program path
5. mysql User access rights
Go to MySQL Database
$mysql-U root-p
>use MySQL;
>select host,user from user;
MySQL to build a user will specify a host, the default is 127.0.0.1/localhost only native access;
Other machines with this user account access will prompt for no permissions, the host is changed to%, which means that all machine access is allowed.
MySQL server 3306 port cannot be remotely connected to resolve