Linux open MySQL Remote connection method
1. Grant command create remote connection MySQL authorized user root
Mysql-u root-p
Mysql>grant all privileges in *.* to root@localhost identified by ' 123456 ' with GRANT OPTION;
Increase root user authorization via local machine (localhost) access, password "123456".
Mysql>grant all privileges in *.* to root@ "%" identified by ' 123456 ' with GRANT OPTION;
Grant access from any other host by the root user (% of the wildcard character).
2, set the firewall allow 3306 ports
Vi/etc/sysconfig/iptables
Add to:
-A rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 3306-j ACCEPT
(Note that the rule will not take effect until the-a rh-firewall-1-input-j reject–reject-with icmp-host-prohibited is added)
Reboot the firewall:
Service Iptables Restart
Troubleshoot problems with MySQL not being able to connect remotely
1, the MySQL port is correct
Check the port occupancy through the NETSTAT-NTLP, generally the bottom of the mouth is 3306. The port is used to connect MySQL with the tool. For example, my adminmy Query browsermysql front.
2, check the user rights are correct
The MySQL library has two records in the user table: the host is localhost and% (for security,% can be replaced by the IP you need to have external connections).
3, check the/ETC/MYSQL/MY.CNF, Skip-networking has been injected
Need to be injected
Error: Error 2003 (HY000): Can ' t connect to MySQL server on ' 192.168.51.112 ' (111)
sudo gedit/etc/mysql/my.cnf
#skip-external-locking
#bind-address = 127.0.0.1
Skip-name-resolve
4, to see whether the iptables stopped, not closed the case, can not connect
Through: Service iptables stop temporary shutdown.
Error: Error 2003 (HY000): Can ' t connect to MySQL server on ' 192.168.51.112 ' (113)