Connect MySQL to Contextflo
Create a read-only MySQL user and connect your database to Contextflo
Last updated: 8/19/2026
Connect your MySQL database to Contextflo with a dedicated read-only user. Works with any hosted MySQL: AWS RDS, Google Cloud SQL, Azure Database for MySQL, PlanetScale, or self-hosted.
Prerequisites
- Admin access to your MySQL database
- The host, port, and database name you want to connect
- Network access from Contextflo to your database (add Contextflo's IPs to your allowlist if needed)
Step 1: Create a read-only user
Run this as an admin in your MySQL client. Update the password and database name before running.
Loading code sample...
- Replace
your_databasewith the database you want to expose.GRANT SELECTis read-only, so Contextflo can never modify your data. - Grant additional databases with more
GRANT SELECT ON another_database.*lines. - The
'%'host allows connections from any address. Scope it to Contextflo's IP range if you prefer.
Step 2: Point at a read replica (recommended)
If you have a read replica, connect Contextflo to it rather than your primary, so an exploratory query over a large table can't load the database serving your app.
Connection Details for Contextflo
In Contextflo, add a MySQL connection under Data Sources and provide:
- Connection Name: A friendly name (e.g., "Production MySQL")
- Host: Your database host
- Port:
3306(default) - Database: Your database name
- Username:
contextflo_readonly - Password: The password you set in the script
- SSL: Enable if your provider requires it
You can also paste a full connection string (mysql://user:pass@host:3306) instead of the individual fields.
Click Test Connection, then save. Contextflo fetches your schema so you can pick which tables to sync.
Verify Permissions
Confirm the grants and test a read:
Loading code sample...
Security Notes
- Read-only access: This setup only grants SELECT permissions. Contextflo cannot modify or delete your data.
- Encrypted storage: Your credentials are encrypted at rest.
- Strong password: Use a long, randomly generated password.
Troubleshooting
Connection timeout
- Check that your firewall or security group allows connections from Contextflo's IPs
- Verify the host and port
- Confirm MySQL accepts remote connections (
bind-addressallows external hosts)
Authentication failed
- Double-check the username and password
- Confirm the user's host pattern (
'%'or a specific IP) covers Contextflo's connection - Enable SSL if your provider requires it
Tables not showing
- Confirm the
GRANT SELECTcovers the right database - Verify you connected to the correct database name