Skip to main content
Guide1 min read

MySQL MCP server: setup for Claude & Cursor (2026)

Connect MySQL or MariaDB to your AI client. Set up the DBHub universal database MCP server with a DSN, read-only mode, config and common fixes.

There is no single "official" MySQL MCP server, but the cleanest route in 2026 is a universal database server — DBHub — that speaks MySQL, MariaDB, Postgres, SQL Server and SQLite through one DSN. Here is the setup for Claude Desktop and Cursor.

Configure the client

DBHub takes a database DSN and a transport. Run it in read-only mode:

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub",
        "--transport", "stdio",
        "--readonly",
        "--dsn", "mysql://user:password@localhost:3306/mydb"
      ]
    }
  }
}

For MariaDB, use the same mysql:// scheme. Restart the client; see MCP config file location if needed.

Why read-only

--readonly blocks INSERT, UPDATE, DELETE and DDL, so the AI can explore and query but not mutate data. Keep it on by default — especially against any shared or production database. More in MCP security best practices.

Verify

Ask: "List the tables and describe the orders table." Real schema back confirms the connection.

Common problems

  • Access denied for user — wrong credentials or the user lacks privileges on that database.
  • ECONNREFUSED 3306 — MySQL is not running or is on a different host/port.
  • Cannot connect from Docker/WSLlocalhost may not resolve to the host; use the host IP or host.docker.internal.
  • No tools in client — Node 18+ required; see Cursor MCP not working.

Going further

A universal DB server is handy when you touch several engines. Browse the databases category, compare options in best MCP server for a database, or grab the backend developer stack.

Loadout

Build your AI agent loadout

The directory of MCP servers and AI agents that actually work. Pick the right loadout for Slack, Postgres, GitHub, Figma and 20+ integrations — with install commands ready to paste into Claude Desktop, Cursor or your own stack.

© 2026 Loadout. Built on Angular 21 SSR.