MySQL Guide
Everything you need to connect to and work with MySQL databases in SQLAgent.
Getting Started
How do I connect to MySQL?
Select MySQL in the database picker, then fill in:
- Host —
localhostor your server's address - Port — default is
3306 - Username — your MySQL user
- Password — your MySQL password
- Database — optional, you can pick one after connecting
Click Connect and you're in. SQLAgent uses a pure Swift implementation of the MySQL wire protocol — no ODBC or JDBC drivers needed.
Which MySQL versions are supported?
SQLAgent supports MySQL 5.x and 8.x. Both mysql_native_password and caching_sha2_password authentication methods are supported.
Can I save my MySQL connection?
Yes. After connecting, your connection is automatically saved. Credentials are stored locally on your Mac — they never leave your machine. Saved connections appear as chips on the connection form for quick reconnection.
Security & Permissions
SSL/TLS encryption
Enable SSL in the connection form to encrypt traffic between SQLAgent and your MySQL server. You can optionally provide a CA certificate, client certificate, and client key for mutual TLS (mTLS) authentication.
SSH tunneling
For databases behind a firewall or bastion host, enable the SSH tunnel section. SQLAgent supports SSH key, SSH agent, and password authentication. The tunnel is established automatically before connecting to MySQL.
Security banner
Before you connect, SQLAgent shows a security banner summarizing your connection's posture:
- Local connection — green, data stays on your machine
- Remote + TLS — green, encrypted
- Remote + SSH — green, tunneled
- Remote + SSH + TLS — green, double-layered encryption
- Remote, no encryption — orange warning, credentials sent in plain text
MySQL permissions model
MySQL uses GRANT-based access control. Each user has a set of privileges (SELECT, INSERT, UPDATE, DELETE, etc.) scoped to specific databases or tables. To see your current privileges, run:
SHOW GRANTS;
The security banner on the connection form reminds you of this — so you know what access model to expect before connecting.
Troubleshooting
Connection timeout or refused
Check that your MySQL server is running and accessible from your network. Verify the host, port, and credentials. If you're behind a firewall, make sure port 3306 is open. For cloud databases, check that your IP is whitelisted.
Authentication failed
Double-check your username and password. For MySQL, ensure the user has permission to connect from your IP address. MySQL 8 defaults to caching_sha2_password — SQLAgent supports both this and the older mysql_native_password.
SSL handshake errors
Make sure your certificates are in PEM format. The CA certificate, client certificate, and client key must all be valid and match. Try toggling Verify server certificate if connecting to a self-signed server.
Failed to read/write packet header
The TCP connection to MySQL was interrupted mid-communication. This usually means the server closed the connection (idle timeout, crash, or network drop). SQLAgent will attempt to reconnect automatically.
Invalid packet length
Received a malformed packet from the MySQL server. This can indicate a protocol mismatch, network corruption, or an incompatible server version.
See the full Error Reference for all error messages.