You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地连接远程MySQL服务器mysql5.domain.de遇2003(10061)错误求助

Fixing MySQL Connection Error (2003) Can't connect to MySQL server on 'mysql5.domain.de' (10061)

Hey there, let's work through this common MySQL connection issue step by step. Error 10061 means your local machine is getting a "connection refused" response from the remote server, so here's what to check:

  • Verify firewall/security group settings on the remote server
    The most common culprit is that the remote server's firewall (or cloud provider security group, if it's hosted on AWS/Azure/GCP) isn't allowing incoming connections on MySQL's default port 3306. You'll need to:

    • Ensure the firewall rules explicitly allow your local public IP address to access port 3306.
    • If you're testing, you can temporarily open port 3306 to all IPs (not recommended for production!) to confirm this is the issue, then lock it down to your specific IP afterward.
  • Check if MySQL is listening for external connections
    By default, MySQL often only listens on the localhost interface (127.0.0.1), which blocks remote connections. To fix this:

    1. Locate your MySQL configuration file (usually my.cnf on Linux, my.ini on Windows).
    2. Look for the bind-address directive — change its value to 0.0.0.0 (to allow all remote IPs) or your specific local IP address.
    3. Make sure the skip-networking line is commented out (if present), as this disables all remote connections entirely.
    4. Restart the MySQL service to apply changes.
  • Confirm your MySQL user has remote access permissions
    Even if the network is open, your user y might only be allowed to connect from localhost. To fix this:

    1. Log into the MySQL server directly (via SSH or local access).
    2. Run this command to grant access from your local IP:
      GRANT ALL PRIVILEGES ON x.* TO 'y'@'your_local_public_ip' IDENTIFIED BY 'pw';
      FLUSH PRIVILEGES;
      
    3. If you need to allow access from any IP (use cautiously for security), replace your_local_public_ip with %.
  • Test basic network connectivity
    First, confirm the domain resolves correctly: run ping mysql5.domain.de in your terminal — it should return the correct public IP of the remote server.
    Then test if the port is reachable:

    • Use telnet mysql5.domain.de 3306 or nc -zv mysql5.domain.de 3306 (if you have netcat installed). If this fails, the issue is definitely network-related, not MySQL configuration.
  • Check local network restrictions
    Don't forget to rule out your own local firewall or proxy settings. Temporarily disable your local firewall to see if the connection works, or check if any proxy is blocking outgoing traffic to port 3306.

内容的提问来源于stack exchange,提问作者user8413951

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 03:47:34