Summary
Connect MySQL databases directly to AI agents via MCP. Query tables and run reports through natural language with AnythingMCP's read-only database connector.
Guided setup
Connect MySQL / MariaDB to Claude, ChatGPT or Copilot in 2 minutes
Start a free trial on AnythingMCP Cloud, connect MySQL / MariaDB in the guided setup, then add your MCP URL to your AI assistant. No code and no server to run.
No credit card · 7-day trial · Self-host alternative available
Try asking
Example prompts for MySQL / MariaDB
Click any prompt to copy it. Paste into Claude, ChatGPT, Cursor, Gemini, Copilot or OpenClaw to run it against this connector.
Claude is AI and can make mistakes. Please double-check responses.
MySQL: Direct Database Access for AI
MySQL is one of the most popular relational databases worldwide. With AnythingMCP's database connector, you can expose your MySQL data directly as MCP tools — letting AI agents interact with your data using natural language.
Important: Read-Only Access
AnythingMCP's database connector is read-only by design. It supports only SELECT queries, with a maximum of 1000 rows per query. This ensures AI agents cannot accidentally modify or delete data.
Auto-Generated Tools
When you create a MySQL database connector, AnythingMCP automatically generates three tools:
| Tool | Description |
|---|---|
get_database_schema | Returns all tables, columns, and types |
get_example_queries | Suggests useful queries based on the schema |
execute_query | Executes a read-only SELECT query (max 1000 rows) |
Step-by-Step Guide
Step 1: Deploy AnythingMCP
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
Step 2: Create a Database Connector
Open the AnythingMCP dashboard at http://localhost:3000 and create a new Database connector. Select MySQL as the database type.
Step 3: Configure Connection
Enter your MySQL host, port, database name, username, and password. Always use SSL for production connections.
Step 4: Test the Connection
Use the dashboard to verify the connection and review the auto-discovered schema. The AI agent will use get_database_schema to understand your data structure.
Step 5: Connect to AI Agents
{
"mcpServers": {
"mysql": {
"url": "http://localhost:4000/mcp"
}
}
}
AI Agent Use Cases
- "Show invoice INV-2026-058 for customer 'Nordic Home Interiors' — I need invoice amount, date and payment status."
- "Who were our top 3 customers by revenue in Q3 2026, and which of them have average payment delays over 30 days?"
- "Find the table/column that stores SKUs, then get current stock for SKU VT-ALPHA-9, list its suppliers and show last 3 goods-receipts for that SKU."
- "Prepare a purchase order for 200 units of part NW-510 to supplier 'NorthWave Components OÜ' — include unit price and standard lead time, and show the SQL INSERT you would run."
Security Best Practices
- Dedicated DB user — Create a MySQL user with SELECT-only permissions
- SSL connections — Always use
require_secure_transport=ONfor production - Restrict databases — Only expose databases that are safe for AI access
- Connection limits — Set
MAX_USER_CONNECTIONSon the MySQL user - Network restrictions — Limit MySQL access to the AnythingMCP server IP
Next Steps
- MariaDB to MCP Guide — MariaDB-specific setup
- PostgreSQL to MCP Guide — PostgreSQL-specific setup
- Database to MCP Guide — All supported databases
Was this guide helpful?