Turn on MySQL remote access permission
The default MySQL user does not have remote access permission, so when the program is not on the same server as the database, we need to turn on MySQL remote access.
There are two main ways to change the table method and the authorization law.
Relatively speaking, it is easier to change the table method, the individual is also more inclined to use this method, so, here only to paste the table method
1. Log in to MySQL
2. Modify the user table of the MySQL library and change the host entry from localhost to%. % here is to allow any host access, if only one IP access, you can change to the corresponding IP, such as can be changed to 192.168.1.123, this means that only allow LAN 192.168.1.123 this IP remote access to MySQL.
Firewall Open 3306 Port
1. Open the firewall configuration file
VI /etc/sysconfig/iptables
2. Add the following line
-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
3. Restart the firewall
Service iptables Restart
Note: The added open 3306-port statement must be preceded by the icmp-host-prohibited
Attached: Personal configuration
# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:i Nput Accept [0:0]:forward Accept [0:0]:output Accept [0:0]-a input-m State--state established,related-j accept-a INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -i eth0 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dpo RT 3306-j accept-a forward-m State--state established,related-j accept-a forward-p icmp-j accept-a forward-i lo-j Accept-a forward-i eth0-j accept-a input-j REJECT--reject-with icmp-host-prohibited-a forward-j REJECT--reject-with Icmp-host-prohibitedcommit
MySQL opens remote access and firewall open port 3306 under Linux