Skip to main content

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.

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.

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

CREATE USER 'querybear'@'%' IDENTIFIED BY 'choose-a-strong-one';
GRANT SELECT ON your_db.* TO 'querybear'@'%';
GRANT SHOW VIEW ON your_db.* TO 'querybear'@'%';
FLUSH PRIVILEGES;
If your MySQL provider restricts '%' (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 dashboardConnectionsNew connectionMySQL:
  • Host, Port (3306), Database, User (querybear), Password
  • SSL moderequire for any non-localhost connection

Step 3: Add QueryBear to Claude Code

claude mcp add --transport http querybear https://mcp.querybear.com/mcp

Step 4: Authorize and verify

claude
The first tool call opens OAuth in browser. Approve. Then ask:
“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 workJSON_EXTRACT, ->, ->> are allowed.
  • For PlanetScale, use the connection string from their dashboard. TLS is mandatory.