use*_*185 5 mysql sysadmin remote-access pymysql
我正在尝试使用 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)")
Run Code Online (Sandbox Code Playgroud)
在我的 my.cnf 文件中,我将绑定地址设置为 0.0.0.0 并且跳过网络不存在。运行 "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
Run Code Online (Sandbox Code Playgroud)
我的防火墙允许来自 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)
Run Code Online (Sandbox Code Playgroud)
我已经多次重新启动一切。我认为这不是 MySQL 身份验证问题。我已将我的用户主机设置为“%”。如何设置服务器侦听 3306 上的任何地址,而不仅仅是 127.0.0.1?
编辑:这是 'ps auxf | 的输出 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
Run Code Online (Sandbox Code Playgroud)
10061是WSAECONNREFUSED“ connection refused”,这意味着您尝试连接的firewall (unlikely)设备要么没有监听,要么更可能没有监听。IP:port
| 归档时间: |
|
| 查看次数: |
6866 次 |
| 最近记录: |