MySQL
Connect MySQL to Formula Bot with a read-only user. Covers setup steps, firewall configuration, SSL, Knowledge Base, and troubleshooting tips.
Connect your MySQL database to analyze data, run queries, and create visualizations using natural language.
Prerequisites
- MySQL 5.7 or higher
- Database credentials (username, password)
- Network access from Formula Bot servers
- A user with SELECT permissions
Connection Details
You'll need the following information:
| Field | Description | Example |
|---|---|---|
| Host | Server hostname or IP | db.example.com |
| Port | MySQL port (default 3306) | 3306 |
| Database | Database name | analytics |
| Username | Database user | readonly_user |
| Password | User password | ******** |
Setup Steps
1. Prepare Your Database
Create a read-only user for Formula Bot (recommended):
CREATE USER 'formulabot'@'%' IDENTIFIED BY 'your-secure-password';
GRANT SELECT ON your_database.* TO 'formulabot'@'%';
FLUSH PRIVILEGES;
2. Configure Firewall Access
Allow connections from Formula Bot's IP addresses. Contact support for the current IP whitelist, or use a secure tunnel.
3. Connect in Formula Bot
- Go to Connectors in the sidebar
- Click Add Connector
- Select MySQL
- Enter your connection details
- Click Test Connection
- If successful, click Save
4. Configure Optional Settings
- Knowledge Base - Enable for better query understanding
- Data Access Controls - Restrict which tables/columns are accessible
Security Best Practices
Never use root or admin credentials. Create a dedicated read-only user for Formula Bot.
Use Read-Only Access
Only grant SELECT permissions to prevent accidental data modification.
Use SSL/TLS
Enable SSL for encrypted connections:
- Check "Use SSL" in connection settings
- Upload your CA certificate if required
Restrict Table Access
Use Data Access Controls to limit which tables Formula Bot can query.
Example Questions
Once connected, ask questions like:
- "How many orders were placed last month?"
- "Show the top 10 customers by revenue"
- "What's the average order value by product category?"
- "Create a chart of daily signups for the past 30 days"
Formula Bot will automatically generate the appropriate SQL queries.
Knowledge Base
Enable Knowledge Base for better results:
- Go to Connectors > your MySQL connector
- Click Configure Knowledge Base
- Add descriptions for tables and columns
- The AI will use this context when generating queries
Example knowledge base entries:
orderstable: "Contains all customer orders with timestamps and totals"customer_idcolumn: "Foreign key to the customers table"
Troubleshooting
Connection Refused
- Verify the host and port are correct
- Check firewall rules allow the connection
- Ensure MySQL is accepting remote connections
Access Denied
- Verify username and password
- Check user has SELECT permissions
- Confirm user can connect from remote hosts
SSL/TLS Errors
- Verify SSL is configured on the MySQL server
- Check the CA certificate is correct
- Try disabling SSL verification for testing
Timeout Errors
- Large queries may time out
- Ask for aggregated data instead of raw rows
- Consider adding indexes to frequently queried columns