【问题标题】:MySQL connection attempt times out with a local IPMySQL 连接尝试使用本地 IP 超时
【发布时间】:2016-04-04 05:38:11
【问题描述】:

我正在尝试通过本地网络连接到 MySQL(使用 --host=192.168.1.xxx),但是当我尝试初始化客户端时,在 MySQL 出错之前大约 1 分钟我没有得到任何响应带有一般的 2003 错误。我的解释是,这意味着连接尝试永远不会在正确的位置结束(因此 TCP 连接只是超时)。

运行 MySQL Server 的机器是一台普通的 Windows 10 笔记本电脑(不运行 Windows Server 或类似的东西)。我已经检查了防火墙规则,并且明确为传入连接启用了端口 3306。运行“netstat -a -n”显示服务器机器上的端口 3306 具有 LISTENING 状态。我已尝试指定端口 3306,以及从​​端口 3306 到路由器上的端口 3306 的端口转发/端口触发,但没有解决此问题。我应该如何使这种连接正常工作?作为参考,我在客户端使用以下命令:

mysql --host=192.168.1.34 --port=3306 --user='username' --password='password'

【问题讨论】:

  • 您应该发布确切的错误,而不是假设错误 2003 是“通用的”。末尾应该有一个数字对应于特定的 Windows 套接字错误,例如 (10060) 表示“连接超时”,而其他错误代码则表示其他问题。

标签: mysql portforwarding


【解决方案1】:

这个问题出现在以下几种情况:

  1. Client and Server, either or both of them are not in network.
  2. Server is not running.
  3. Server is running but not listening on port, client is trying to connect.
  4. Firewall is not permitted for host-port combination.
  5. Host port combination is incorrect.

上面的Client是指你的本地系统,server是指运行MySQL的机器。To solve the problem:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多