我正在尝试远程连接到数据库。
我将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根-p没有问题,但mysql -h 192.168.x.yyy -u根-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
发布于 2021-02-27 22:04:02
在您引用的mysqld.cnf中,您包含了禁止所有外部网络访问MySQL服务器的skip-networking规则。
如果需要远程访问,则应删除此规则并重新启动mysql服务器进程。
有关更多详细信息,请参阅the documentation。
https://stackoverflow.com/questions/66399500
复制相似问题