Skip to Content
Connect Claude to MySQL with MCP
Connect Claude to MySQL with MCP

Use Claude with MySQL through MCP for schema discovery, read-only analysis, and faster SQL questions. Compare the direct MySQL server with Gateway-style alternatives, copy a safer starter config, and control the permission boundary.

Connect Claude to MySQL with MCP

Connect Claude to MySQL with MCP

If your goal is “let Claude inspect a MySQL database and answer SQL questions without giving it broad production write power,” this is the shortest path.

ServerBest forNot ideal whenAuthPermission risk
MySQL MCP ServerDirect MySQL access, schema inspection, and query executionYou want a governed API layer instead of direct DB accessDB credentialsMedium
Centralmind GatewayTeams that want a safer API-like layer between Claude and the databaseYou need the shortest possible local setupConnection string + gateway configMedium
Connect Claude to SQL Databases with MCPComparing MySQL against BigQuery, Snowflake, ClickHouse, or FireproofYou already know MySQL is the targetMixedMedium

Quick selection (30 seconds)

  • Pick MySQL MCP Server if you want the most direct and readable MySQL setup.
  • Pick Gateway if governance, PII filtering, or auditability matter more than setup speed.
  • Start with a dedicated read-only MySQL user either way.

Copy-paste config (Claude Desktop)

{
  "mcpServers": {
    "mysql": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/mysql_mcp_server",
        "run",
        "mysql_mcp_server"
      ],
      "env": {
        "MYSQL_HOST": "localhost",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "mcp_readonly_user",
        "MYSQL_PASSWORD": "REPLACE_ME",
        "MYSQL_DATABASE": "analytics"
      }
    }
  }
}

MySQL checklist

VariableRequiredSensitiveNotes
MYSQL_HOSTYesNoPrefer a private hostname, not a public endpoint
MYSQL_PORTOptionalNoDefaults to 3306 in most setups
MYSQL_USERYesNoUse a dedicated least-privilege account
MYSQL_PASSWORDYesYesKeep out of repo files
MYSQL_DATABASEYesNoScope to the smallest useful dataset

First tool-call prompts

  • “List all available tables and identify the five most relevant for product analytics.”
  • “Run a read-only query for weekly active users in the last eight weeks.”
  • “Explain this SQL result in plain English and highlight possible data quality issues.”

Risk and permission notes

  • The main risk is not the MCP layer, but the database role you give it.
  • Do not use root or a broad application user for the first rollout.
  • If production is sensitive, test first against a staging replica or a restricted analytics schema.

FAQ

Should I choose direct MySQL MCP or Gateway?

Choose direct MySQL MCP for speed and simplicity. Choose Gateway if you need stronger audit, filtering, or policy controls between Claude and the database.

Can I allow writes later?

Yes, but only after read-only usage is stable and you have a narrow workflow that genuinely needs writes.

What is the fastest way to reduce risk?

Use a read-only MySQL user, scope the database tightly, and log early queries during rollout.

Sources and freshness

  • Sources: official server pages linked above.
  • Updated: March 15, 2026.
Last updated on