【发布时间】:2021-02-27 13:56:50
【问题描述】:
我正在尝试远程连接到数据库。
我把mysqld.cnf改成
[mysqld]
bind-address = 192.168.x.yyy
mysqlx-bind-address = 192.168.x.yyy
skip-networking
我用 iptables -S 检查了端口
-A INPUT -p tcp -m tcp --dport 3306 -c 10 600 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3306 -c 0 0 -j ACCEPT
我尝试运行 telnet 192.168.x.yyy 3306
telnet: Unable to connect to remote host: Connection refused
当然,我打过电话
sudo service mysql restart
命令 mysql -u root -p 可以但是 mysql -h 192.168.x.yyy -u root -p 返回
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.x.yyy' (111)
mysql.user 包含的表:
mysql> select Host,User from user;
+---------------+------------------+
| Host | User |
+---------------+------------------+
| 192.168.x.yyy | root |
| ...
| localhost | root |
+---------------+------------------+
ifconfig 返回:
enp2s0f0: ...
inet 192.168.x.yyy netmask 255.255.255.0 broadcast 192.168.x.255
我正在运行 Ubuntu 20.04.1 LTS 和 mysqld 8.0.23
【问题讨论】: