Current Situation
Recently in the study of WordPress, so in WINDOWS10 (hereinafter referred to as the host) under the virtual machine set up Ubuntu 16.04 (hereinafter referred to as the passenger plane), the host ip:192.168.1.101, passenger aircraft using bridge connection, passenger aircraft ip:192.168.1.102.
problem
Found that the host can ping the passenger plane, the passenger plane can also ping the host, but the MySQL 3306 port is not reachable, resulting in the host under the Navicat can not access to the MySQL in the airliner.
Resolution Step 1. Open firewall 3306 Port
Ubuntu uses UFW auxiliary settings firewall, via command sudo ufw from 192.168.1.101 allows host 192.168.1.101 access to all ports of the passenger plane, of course alone via command sudo ufw allow 3306 It is also set up for 3306 port access separately. Here the airliner firewall has opened the relevant ports to the host. But the host Navicat still can't access the airliner MySQL.
2. Query port monitoring is normal
by command netstat-ant | grep 3306, check the 3306 port of the airliner Linux is established (listening), However, monitoring is limited to 127.0.0.1:3306, which means that MySQL only listens on the 3306 port of 127.0.0.1 address. Then you must modify the MySQL listening address to allow the host to access the airliner's MySQL.
3. Modify the MySQL port listening settings
How do I change the configuration of MySQL? Many versions of the Web are talking about looking for/etc/my.cnf, or/ETC/MYSQL/MY.CNF configuration. ls/etc/my.cnf No results,/ETC/MYSQL/MY.CNF is there, through the sudo vim/etc/mysql/my.cnf open a look, what all wood has AH
This is my stupid.
Go to these 2 directories look for Bai, tu, god Beloved, the original real configuration file in/etc/mysql/mysql.conf.d directory , is mysqld.cnf file, execute command sudo vim/etc/mysql/ MYSQL.CONF.D/MYSQLD.CNF
/etc/mysql/mysql.conf.d/mysqld.cnf
Comment out bind-address=127.0.0.1
Use # comment out bind-address=127.0.0.1, undo bind only 127.0.0.1 address, if not annotated, modify to 0.0.0.0 All machines can access the MySQL server.
Funnytiger
Links: Https://www.jianshu.com/p/d35c6f982bbe
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
ubuntu16.04 under MySQL configuration (1)