Navicat connects to MySQL on centos 7 server

Purpose: Navicat connects to MySQL on centos 7 server.

  1. First of all, we need to open port 3306, so first check whether the iptables firewall is installed (see whether the /etc/sysconfig/iptables file exists). If it does not exist, you need to install it first;

Why do some exist and some don't? Because if the installed centos7 is the minimum installation method, there will be many things that are not installed and need to be installed manually.
/etc/sysconfig/iptables does not exist, that is, the iptables firewall is not installed.
You can with the following command
systemctl stop firewalld
systemctl mask firewalld
yum install iptables-services
service iptables status
//After setting the boot
systemctl enable iptables
, you can find /etc /sysconfig/iptables file

2. Execute the statement after the installation is complete

#vim /etc/sysconfig/iptables

Modify the file to open port 3306
Add content

-A INPUT -p tcp -m state –state NEW -m tcp –dport 3306 -j ACCPEPT

write picture description here

Then restart the firewall

#service iptables restart

3. Now we have opened port 3306, but when we installed MySQL, only the localhost host was allowed to access, so we need to authorize to allow remote connections.
Open MySQL and execute the following statement;
write picture description here

Using the mysql database, grant all privileges (all privileges) of all tables ( . ) of all databases to the root user accessed through any ip (%), password is * , and finally refresh ( flush privileges ) on it.

Then you can connect on Navicat.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325480175&siteId=291194637