Remote connection of MySQL database in LNMP environment
First, for the sake of security, LNMP environment is forbidden remote connection, he will delete the iptables inside the 3306 Port firewall rule
First, if it is phpmydmin to the authority to the remote connection to the user host to change to *
Reference:
Https://bbs.vpser.net/thread-3135-1-1.html
Or
Mysql-uroot-p Enter password
Use MySQL;
Update user Set host = '% ' where user= ' root ';
Flush privileges;
Exit
Root can be replaced by our user name
If you do not create a user, perform
Grant all privileges the on database name. * To user name @ '% ' identified by ' password ';
For example: Grant all privileges the mysql.* to ' root ' @ ' percent ' identified by ' 123456 ';
Displays all iptables as an ordinal tag, executing:
Iptables-l-N--line-numbers
Add 3306 port number to firewall
Iptables-i input-p TCP--dport 3306-j ACCEPT
Service Iptables Save
Service Iptables Restart
Service MySQL Restart
Then use the Mysqlyog connection database to try, you can first use the test connection test in the lower right corner of the Mysqlyog
Second, in order to be safe, the LNMP environment is forbidden to connect remotely, he will remove the firewall rule of the 3306 port inside the iptables
Iptables Delete the drop 3306 port
Reference Iptables Tutorials
Htttps://www.vpser.net/security/linux-iptables.html
To delete a iptables rule that has been added
Displays all iptables as an ordinal tag, executing:
Iptables-l-N--line-numbers
For example, to delete the rule execution with the sequence number 8 in input:
Iptables-d INPUT 8
This article is from the "12252646" blog, please be sure to keep this source http://12262646.blog.51cto.com/12252646/1947251
Solve the problem of not connecting to MySQL in the LNMP environment