Sequel Pro’s “Can’t connect to MySQL server” error is often caused by a missing or misconfigured SSH tunnel, and the fix is to set up an SSH tunnel in Sequel Pro’s connection settings. This article explains why the error happens, how to configure the SSH tunnel correctly, and what to do when it still won’t connect.
Why Sequel Pro Needs an SSH Tunnel
MySQL databases are often hosted on remote servers that don’t allow direct internet connections to port 3306 (the default MySQL port). Instead, you connect to the server via SSH (port 22), which is a secure, encrypted channel. Sequel Pro can create an SSH tunnel automatically: it opens an SSH connection to your server, then forwards your local MySQL traffic through that encrypted channel to the database server. This way, you don’t need to expose MySQL to the public internet, which is a common security best practice.
Without the SSH tunnel, Sequel Pro tries to connect directly to the MySQL host and port you specified. If that port is firewalled or not listening, you get the “Can’t connect to MySQL server” error. The fix is to tell Sequel Pro to use SSH, so it tunnels the connection.
How to Set Up an SSH Tunnel in Sequel Pro
Here’s how to configure Sequel Pro to use an SSH tunnel:
- Open Sequel Pro and click “New Connection” (or select an existing connection to edit).
- In the “Connection” tab, choose “SSH” from the “Connect via” dropdown menu.
- Enter the MySQL host details: usually “localhost” or “127.0.0.1” as the host, and the MySQL port (default 3306). This is the address of the MySQL server as seen from the SSH server.
- Enter your SSH server details: the SSH host (e.g., your server’s IP or domain), SSH port (default 22), and your SSH username (often the same as your server login).
- Choose an authentication method: password, or SSH key (if you have one). For keys, click “Use key” and select your private key file.
- Optionally, set a name for the connection and save it.
- Click “Connect” to test the connection. If successful, you’ll see the database list.
If you’re using a key with a passphrase, Sequel Pro will prompt you for it. If you use a password, it will ask for that each time (unless you save it in the keychain, which is optional).
Common Causes of Connection Failure
Even with SSH selected, you might still see the error. Here are the most common causes and how to fix them:
- Wrong SSH port: If your server uses a non-standard SSH port (e.g., 2222), you must enter that in the SSH port field. Default is 22.
- SSH authentication failure: Double-check your username and password/key. If you use a key, make sure the file path is correct and the key has the right permissions (on macOS, it should be 600).
- MySQL host is not localhost: If your MySQL server is on a separate machine from the SSH server, enter that machine’s hostname or IP in the MySQL host field, not “localhost”.
- MySQL port is not 3306: If MySQL runs on a custom port (e.g., 3307), enter that in the MySQL port field.
- Firewall blocking SSH: Your local network or the server’s firewall might block port 22. Test with a tool like
sshin Terminal to see if you can connect. - MySQL user permissions: The MySQL user you’re using might only be allowed to connect from certain hosts. If you connect via SSH and use “localhost” as the MySQL host, the MySQL user must be allowed to connect from ‘localhost’ (or ‘%’ for any host).
Testing Your SSH Connection Manually
If Sequel Pro still fails, test the SSH connection separately to isolate the problem. Open Terminal and run:
ssh your_username@your_server_ip -p your_ssh_port
If that works, you know SSH is fine. Then, once connected, try connecting to MySQL from the server itself:
mysql -u your_mysql_user -p -h localhost -P 3306
If that works, the issue is likely in Sequel Pro’s configuration. If it fails, the problem is on the server side (MySQL not running, permissions, etc.).
Alternative: Use a Direct Connection (If Allowed)
If SSH is not required (e.g., your MySQL server is on the same network or has a public port), you can try a direct connection. In Sequel Pro, choose “Standard” from the “Connect via” dropdown, and enter the MySQL host and port directly. This only works if the MySQL server is reachable and the port is open. Many hosting providers disable direct connections for security, so SSH is often the only way.
If you’re using a managed database service (like Amazon RDS), they often provide an SSH tunnel endpoint or require you to use a VPN. Check your provider’s documentation for the correct connection method.
Frequently Asked Questions
Why does Sequel Pro say “Can’t connect to MySQL server” even with SSH?
This usually means the SSH connection succeeded but the MySQL connection through the tunnel failed. Check that the MySQL host is correct (often “localhost”), the port is right, and the MySQL user has permission to connect from that host. Also, ensure MySQL is actually running on the server.
Do I need to use “localhost” as the MySQL host when using SSH?
Usually yes, because the SSH tunnel makes it appear as if you’re connecting from the server itself. If your MySQL server is on a different machine, you need to enter that machine’s address. Some setups use a socket file instead of TCP; in that case, you might need to specify the socket path.
Can I use an SSH key with Sequel Pro?
Yes, Sequel Pro supports SSH key authentication. In the SSH section, select “Use key” and choose your private key file. Make sure the key is in the correct format (PEM) and has appropriate file permissions.
What if my SSH port is not 22?
Enter the correct port number in the “SSH Port” field. The default is 22, but many servers use a different port for security. If you’re unsure, check with your hosting provider.
How do I save my SSH password so I don’t type it every time?
Sequel Pro can store your SSH password in the macOS Keychain. When you connect, check the “Save password to keychain” option. For SSH keys, you can add the passphrase to the keychain using the ssh-add command in Terminal.
Sequel Pro is discontinued—should I switch to another tool?
Sequel Pro is no longer actively developed, but it still works for many users. If you’re having persistent issues, consider alternatives like TablePlus, DBeaver, or MySQL Workbench. They offer similar features and are actively maintained. However, the SSH tunnel concept is the same across all these tools.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Delete Picture Kik? How to Remove Photos
- Data Breaches That Shook the World
- Disable Google Assistant: Turn It Off on Android & Home
- Resin vs FDM Printers for Miniatures: Detail, Durability, Cost
- Are Networked Implants Safe? What If One Fails?
- How to Stop WordPress Comment Spam: A Layered Guide