1. Open MySQL Access port 3306 Modify the firewall profile Vi/etc/sysconfig/iptables join port configuration Note: The added open 3306-port statement must be before icmp-host-prohibited-A input-m State--state new-m tcp-p TCP--dport 3306-j accept Reload Rule service iptables Restart default MySQL user is not authorized for remote access, so when the program is not on the same computer as the database On the server, we need to turn on MySQL remote access permission. 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, therefore, only paste the change Table Method 2. Modify the host login in the MySQL library mysql;use mysqlupdate user set host= '% ' where user= ' root ' and host= ' localhost '; remember that you must also change the password, because then the password is invalid, although the local can also log in the original password, can be remotely changed host or cannot access the update user SET Password=password ("root") WHERE user= ' root '; Flush privileges;3. Restart MySQL, remote access to the service mysqld restart; CentOS7 turn on MySQL remote access CentOS7 This version of the firewall uses the default firewall, unlike the previous version using Iptables. Configure the firewall as follows: 1, turn off the firewall: sudo systemctl stop firewalld.service2, turn off boot: sudo systemctl disable Firewalld.service 3, Install iptables Firewall Execute the following command install iptables firewall: sudo yum install iptables-services?4, configure iptables firewall, open the specified port (CentOS6) 5, Set iptables firewall on boot: sudo systemctl enable IPTABLES6, after and CentOS6 the basic operation of the firewall under CentOS Configuration firewall operation instance (start, stop, open, closed port): Note: The basic operation of the Firewall command: query firewall status: [[email protected] ~]# service iptables status Stop firewall: [[email protected] ~]# service iptables Stop boot firewall: [[em Ail protected] ~]# service iptables start reboot firewall: [[email protected] ~]# service iptables Restart permanently shut down the firewall: [[EMA Il protected] ~]# chkconfig iptables off permanently closed after enabled: [[email protected] ~]# chkconfig iptables on
CentOS7 and CentOS6 How to turn on MySQL remote access