简体   繁体   English

3306端口没有收听? 无法远程连接MySQL

[英]Port 3306 not listening? Can't connect to MySQL remotely

I'm trying to connect to MySQL remotely with pymysql and I'm getting the error message: 我正在尝试使用pymysql远程连接到MySQL,我收到错误消息:

(2003, "Can't connect to MySQL server on 'ip address' ([WinError 10061] 
No connection could be made because the target machine actively refused it)")

In my my.cnf file I've got bind-address set to 0.0.0.0 and skip-networking isn't there. 在我的my.cnf文件中,我将bind-address设置为0.0.0.0,并且不存在skip-networking。 Running "sudo netstat -atn" shows port 3306 is only listening on localhost: 运行“sudo netstat -atn”显示端口3306仅侦听localhost:

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN

My firewall allowing traffic from 3306: 我的防火墙允许来自3306的流量:

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
22/udp                     ALLOW       Anywhere
80/udp                     ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
443/udp                    ALLOW       Anywhere
3306/tcp                   ALLOW       Anywhere
3306/udp                   ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
22/udp (v6)                ALLOW       Anywhere (v6)
80/udp (v6)                ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)
443/udp (v6)               ALLOW       Anywhere (v6)
3306/tcp (v6)              ALLOW       Anywhere (v6)
3306/udp (v6)              ALLOW       Anywhere (v6)

I've restarted everything multiple times. 我多次重启了一切。 I don't think its a MySQL authentication issue. 我不认为它是MySQL身份验证问题。 I've got my users host set to '%'. 我的用户主机设置为'%'。 How do I set the server to listen to any address on 3306, not just 127.0.0.1? 如何将服务器设置为侦听3306上的任何地址,而不仅仅是127.0.0.1?

Edit: Here's the output from 'ps auxf | 编辑:这是'ps auxf |的输出 grep mysqld ': grep mysqld':

root     15493  0.0  0.4  11988  2072 pts/0    S+   12:25   0:00          \_ 
grep --color=auto mysqld
root     25057  0.0  0.3   4448  1540 tty1     S    Jun13   0:00      \_ 
/bin/sh /usr/bin/mysqld_safe --skip-grant-tables
mysql    25415  0.1  8.8 821124 44224 tty1     Sl   Jun13   8:04          \_ 
/usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-
dir=/usr/lib/mysql/plugin --user=mysql --skip-grant-tables --log-
error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --
socket=/var/run/mysqld/mysqld.sock --port=3306
mysql    15361  0.2  7.4 380788 37416 ?        Ssl  12:24   0:00 
/usr/sbin/mysqld
15042  0.0  7.4 380788 37164 ?        Ssl  12:21   0:00 /usr/sbin/mysql                            
d

10061WSAECONNREFUSED ,' connection refused ',这意味着要么是firewall (unlikely)要么更可能没有收听你尝试连接的IP:port

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法通过 3306 端口连接到远程 MYSQL 服务器 - Can't Connect to the remote MYSQL server via 3306 port 即使 mysqld 在端口 3306 上运行,也无法连接到“localhost:3306”上的 MySQL 服务器 - Can't connect to MySQL server on 'localhost:3306' even though mysqld is running on port 3306 找不到 MySql 端口 3306 - Can't find MySql port 3306 无法启动MySQL,3306端口忙 - Can't start MySQL, port 3306 busy 我更改端口号而不是3306时无法连接到mysql - Can't connect to mysql when I changed its port number rather than 3306 Django-默认端口0而不是3306-无法连接到'127.0.0.1'上的MySQL服务器(61) - Django - default port 0 instead of 3306 - Can't connect to MySQL server on '127.0.0.1' (61) 如何修复'无法连接到'localhost:3306'上的MySQL服务器'错误 - How to fix 'Can't connect to MySQL server on 'localhost:3306' error 如何修复 InterfaceError:2003:无法连接到“127.0.0.1:3306:3306”上的 MySQL 服务器(11001 getaddrinfo 失败) - How to fix InterfaceError: 2003: Can't connect to MySQL server on '127.0.0.1:3306:3306' (11001 getaddrinfo failed) xampp mysql不在端口3306上运行 - xampp mysql doesn't run on port 3306 无法远程连接到MySQL服务器 - Can't connect to MySQL server remotely
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM