# mcp-server-mysql

> mcp-server-mysql is an open-source MCP server for databases. MCP server giving Claude and other LLMs read, and optional write, access to MySQL. It is available on CLI, API, Self-hosted, Linux, macOS and Windows.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, Self-hosted, Linux, macOS, Windows
- **Repository:** https://github.com/benborla/mcp-server-mysql
- **GitHub stars:** 2,233
- **License:** MIT
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-12-01

## About

Connects an AI assistant to a MySQL database so it can inspect table structures, run SQL and pull answers from live data. Queries are read-only unless write flags are switched on per operation type, which keeps the default footprint small for analysts and developers exploring production-like data.

The server adds several safeguards on top of basic query access. Per-database permissions let you allow writes on some schemas while locking others, PII redaction masks sensitive values in results, and multi-DB mode lets one session query several databases without reconnecting. Connections can run through an SSH tunnel or use SSL/TLS, including mutual TLS.

It is aimed at developers who already use Claude Code or a similar MCP client and want the model to answer questions about their MySQL data directly. A remote HTTP mode with bearer token auth is available for shared setups.

## Features

- **Read-only by default:** Write operations stay disabled until insert, update or delete flags are explicitly enabled.
- **Schema-level permissions:** Read and write control can be set separately for each database.
- **PII redaction:** Sensitive values are masked automatically in query results.
- **Multi-database mode:** Run queries across several databases without reconnecting.
- **SSH tunnel support:** Reach remote MySQL instances through a built-in SSH tunnel.
- **SSL and mTLS:** Encrypted connections with an optional mutual TLS configuration.
- **Remote HTTP mode:** Serve the server over HTTP with bearer token authentication.

## Good for

- Letting an AI assistant explore unfamiliar database schemas
- Answering ad hoc data questions from a local MySQL database
- Querying several databases in one session without reconnecting
- Running guarded updates through an assistant with explicit write permissions

## Tools

From the tool list in its README, going by the names, all 1 tool only read data. From the server's own tool labels and tool names; not verified by us.

- `mysql_query` (name suggests: reads): Execute SQL queries. Read-only by default. Write operations enabled per flag.

## FAQ

### Can mcp-server-mysql modify data by default?

No. All write operations are disabled until the insert, update or delete flags are set to true.

### Which MySQL versions are supported?

MySQL 5.7 and newer, with 8.0 or later recommended. It needs Node.js v20 or newer.

### How is mcp-server-mysql installed?

It runs through npx with the @benborla29/mcp-server-mysql package, configured with the MySQL connection environment variables in Claude Code or another MCP client.

### What is the license?

The project is released under the MIT license.

### Is mcp-server-mysql free?

Yes. mcp-server-mysql is open source, so you can use and self-host it for free.

### What are the best alternatives to mcp-server-mysql?

The closest alternatives to mcp-server-mysql are mysql_mcp_server, mysql-mcp-server, mcp-mysql-server, Read Only Local Mysql MCP Server and Db Access MCP.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [mysql_mcp_server](https://ai-powered.com/mcp/mysql-mcp-server-4): mysql_mcp_server is an open-source MCP server for databases.
- [mysql-mcp-server](https://ai-powered.com/mcp/mysql-mcp-server-3): mysql-mcp-server is an open-source MCP server for databases.
- [mcp-mysql-server](https://ai-powered.com/mcp/mcp-mysql-server): mcp-mysql-server is an open-source MCP server for databases.
- [Read Only Local Mysql MCP Server](https://ai-powered.com/mcp/read-only-local-mysql-mcp-server): Read Only Local Mysql MCP Server is an open-source MCP server for databases.
- [Db Access MCP](https://ai-powered.com/mcp/db-access-mcp): Db Access MCP is an open-source MCP server for databases.
- [Mysql](https://ai-powered.com/mcp/mysql): Mysql is an open-source MCP server for databases.
- [postgres_mcp](https://ai-powered.com/mcp/postgres-mcp-5): postgres_mcp is an open-source MCP server for databases.
- [MySQL MCP Server](https://ai-powered.com/mcp/mysql-mcp-server): MySQL MCP Server is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/mcp-server-mysql
