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:

FieldDescriptionExample
HostServer hostname or IPdb.example.com
PortMySQL port (default 3306)3306
DatabaseDatabase nameanalytics
UsernameDatabase userreadonly_user
PasswordUser 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

  1. Go to Connectors in the sidebar
  2. Click Add Connector
  3. Select MySQL
  4. Enter your connection details
  5. Click Test Connection
  6. 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:

  1. Check "Use SSL" in connection settings
  2. 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:

  1. Go to Connectors > your MySQL connector
  2. Click Configure Knowledge Base
  3. Add descriptions for tables and columns
  4. The AI will use this context when generating queries

Example knowledge base entries:

  • orders table: "Contains all customer orders with timestamps and totals"
  • customer_id column: "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

Next Steps