This guide walks through connecting MySQL (or MariaDB) to Claude Code using QueryBear’s managed MCP server. End result: your terminal Claude session can read your MySQL database safely — no write access, no sensitive columns, every query logged.Documentation Index
Fetch the complete documentation index at: https://docs.querybear.com/llms.txt
Use this file to discover all available pages before exploring further.
What you’ll need
- A QueryBear account (sign up free)
- A MySQL or MariaDB database (5.7+ / 10.x+)
- Claude Code installed
Step 1: Create a read-only MySQL user
'%' (AWS RDS, sometimes), replace it with QueryBear’s egress IP — found in the dashboard under Connections → Network.
Step 2: Add the connection to QueryBear
In the QueryBear dashboard → Connections → New connection → MySQL:- Host, Port (3306), Database, User (
querybear), Password - SSL mode —
requirefor any non-localhost connection
Step 3: Add QueryBear to Claude Code
Step 4: Authorize and verify
“What QueryBear tools do you have? List my connections.”You should see your MySQL connection.
Try it
“In the production MySQL database, find the top 10 products by units sold last month. Pull the schema first.”Claude calls
get_schema on products and orders, writes the join + group-by query, and runs it through QueryBear.
MySQL + Claude Code gotchas
- Multi-statement queries are blocked.
SELECT 1; DROP TABLE x;is rejected at the parser even though MySQL would happily run both. - Stored procedure calls are blocked by default — procs can mutate state. Allow-list explicitly per connection if needed.
- MariaDB sequence syntax works transparently.
- JSON columns work —
JSON_EXTRACT,->,->>are allowed. - For PlanetScale, use the connection string from their dashboard. TLS is mandatory.
Related
- MySQL MCP server — MySQL-specific deep dive
- Claude Code client — Claude Code overview
- Security model — what the gateway protects against