Enable mysql remote connection in Linux
Procedure for enabling mysql remote connection in Linux.
Mysql remote connection linuxserviceserveruserMysql by default, the root user can only access the local database, but cannot remotely connect to and manage the mysql database. How does one enable mysql remote connection in Linux? The procedure is as follows:
1. GRANT command to create a remote connection mysql authorized user test
Mysql-u root-p
Mysql> grant all privileges on *. * TO test @ localhost identified by 'test' with grant option;
Mysql> grant all privileges on *. * TO test @ "%" identified by 'test' with grant option;
In the first sentence, the itlogger user is authorized to access through the Local Machine (localhost) and the password is 'test '. The second sentence is to authorize the test user to initiate access from any other host (wildcard % ).
2. Set the firewall to allow port 3306
Vi/etc/sysconfig/iptables
Add
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT
(Note that before-A RH-Firewall-1-INPUT-j REJECT -- reject-with icmp-host-prohibited, otherwise the rule may not take effect)
Restart Firewall service iptables restart