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

使用Sequel Pro连接127.0.0.1时遇MySQL连接错误(61),求解决方法

Hey there, let's figure out how to fix that MySQL connection error you're seeing! The Can't connect to MySQL server on '127.0.0.1' (61) error typically means your local MySQL server isn't accessible, so here are the step-by-step fixes you can try:

1. Make sure MySQL Server is actually running

First things first—if the server isn't up, you can't connect to it. Depending on how you installed MySQL on your Mac:

  • If you used Homebrew, run this command to check status:
    brew services list
    
    If MySQL shows as "stopped", start it with:
    brew services start mysql
    
  • If you installed it via the official DMG, check with launchctl:
    sudo launchctl list | grep mysql
    
    Start it with:
    sudo launchctl start com.mysql.mysqld
    
2. Confirm MySQL is listening on Port 3306

By default, MySQL uses port 3306. If it's using a different port or not listening at all, you'll get this error. Run this command to check:

lsof -i :3306

If you don't see any MySQL-related entries here, either:

  • Update your Sequel Pro connection settings to use the correct port (if you changed it manually), or
  • Edit your MySQL config file (my.cnf or my.ini, usually found in /usr/local/mysql/etc/ or /etc/) to set port = 3306 and restart the server.
3. Check if your local firewall is blocking the connection

Sometimes macOS's built-in firewall can block local MySQL connections. To test this temporarily:

  • Open System Preferences > Security & Privacy > Firewall
  • Click the lock to make changes, then turn off the firewall
  • Try connecting with Sequel Pro again. If it works, add MySQL to the firewall's allowed apps list before turning the firewall back on.
4. Verify MySQL's network configuration settings

Open your MySQL config file and check these two key settings:

  • bind-address: This should be set to 127.0.0.1 (allow only local connections) or 0.0.0.0 (allow all connections). If it's set to a different IP, local connections will fail.
  • skip-networking: If this line exists and isn't commented out, it disables TCP/IP connections entirely. Comment it out with a # at the start of the line.

After making changes, restart MySQL to apply them.

5. Ensure your MySQL user has permission to connect via 127.0.0.1

Sometimes users are set up only to connect via localhost (which uses a Unix socket, not TCP/IP), but 127.0.0.1 uses TCP/IP. To fix this:

  • First, connect to MySQL using the socket (run mysql -u root in Terminal if you don't have a password, or mysql -u root -p to enter your password)
  • Run these commands to grant access for your user to connect via 127.0.0.1:
    GRANT ALL PRIVILEGES ON *.* TO 'your_username'@'127.0.0.1' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    
    Replace your_username and your_password with your actual MySQL credentials.
6. Reinstall MySQL (last resort)

If none of the above fixes work, there might be a corruption in your MySQL installation. Make sure to back up any databases you need first, then uninstall MySQL completely and reinstall it using your preferred method (Homebrew, official DMG, etc.).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 04:16:51