Directly on the method: first configure the CentOS firewall iptables rule:
# vim /etc/sysconfig/iptables
Add the following rules to them:
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
Description: Firewall open HTTP with 80 ports and 3306 ports connected to MySQL.
# service iptables restart
Then configure MySQL to allow remote login: Connect the MySQL database in CentOS first
# mysql -uroot -proot
Perform
> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY‘123456‘ WITH GRANT OPTION;
Then execute the next
> flush privileges;
Do not restart the MySQL service. After the final configuration is complete, open the Navicat under Windows to connect directly to the database under CentOS.
Navicat connecting to MySQL in a virtual machine (CentOS)