这是运行Ubuntu 16.04的VPS上的MariaDB / MySQL版本:
mysql Ver 15.1 Distrib 10.0.29-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
这可能是/etc/mysql/mariadb.conf.d/50-server.cnf
的相关内容:
1 #
2 # These groups are read by MariaDB server.
3 # Use it for options that only the server (but not clients) should see
4 #
5 # See the examples of server my.cnf files in /usr/share/mysql/
6 #
7
8 # this is read by the standalone daemon and embedded servers
9 [server]
10
11 # this is only for the mysqld standalone daemon
12 [mysqld]
13
14 #
15 # * Basic Settings
16 #
17 user = mysql
18 pid-file = /var/run/mysqld/mysqld.pid
19 socket = /var/run/mysqld/mysqld.sock
20 port = 3306
21 basedir = /usr
22 datadir = /var/lib/mysql
23 tmpdir = /tmp
24 lc-messages-dir = /usr/share/mysql
25 skip-external-locking
26
27 # Instead of skip-networking the default is now to listen only on
28 # localhost which is more compatible and is not less secure.
29 bind-address = 0.0.0.0 #This is line changed by me from 127.0.0.1
30
使用systemctl stop mysql
和systemctl start mysql
后,这仍然是netstat -nat |grep :3306
的输出:
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3306 127.0.0.1:54316 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58456 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58466 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58458 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58454 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58460 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58444 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58452 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58446 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58462 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58464 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58450 ESTABLISHED
tcp 0 0 127.0.0.1:3306 127.0.0.1:58468 ESTABLISHED
正如您在第一行中看到的那样,它仍在127.0.0.1
上,而不在0.0.0.0
上。我哪里可能出错? TIA