CentOS7 and CentOS6 How to turn on MySQL remote access

Source: Internet
Author: User
Tags iptables

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.