Original address: Portal
0. Preface
I saw a lot of open Mysql remote access ports on the Internet, but I couldn't find the modified configuration files.
Checked out my Linux version specifically
$ sudo lsb_release -a
The display is as follows:
Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS Release: 16.04 Codename: Great
1. Check whether port 3306 is normal
root@node1:~# netstat -an | grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
Note: The current IP address bound to port 3306 is the local 127.0.0.1
2. Modify the Mysql configuration file (note the path, which is different from many previous versions on the Internet)
root@node1:~# vim /etc/mysql/mysql.conf.d/mysqld.cnf
turn up
bind-address = 127.0.0.1
Add # in front of it to comment out
3. Restart Mysql
root@node1:~# /etc/init.d/mysql restart
[ ok ] Restarting mysql (via systemctl): mysql.service.
4. Check the port information again
root@node1:~# netstat -an | grep 3306 tcp6 0 0 :::3306 :::* LISTEN
OK!