# MySQL MCP server

> Lets an AI client explore MySQL databases, inspect schemas, sample table data, and run SQL queries.

- Repository: https://github.com/designcomputer/mysql_mcp_server
- Page: https://hostedmcp.org/servers/designcomputer/mysql-mcp-server
- Transport: —
- Stars: 1417
- License: MIT

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `MCP_SSE_ALLOWED_HOSTS` | no | no |  |
| `MCP_SSE_HOST` | no | no |  |
| `MCP_TRANSPORT` | no | no |  |
| `MYSQL_AUTH_PLUGIN` | no | no |  |
| `MYSQL_CHARSET` | no | no |  |
| `MYSQL_COLLATION` | no | no |  |
| `MYSQL_CONNECT_TIMEOUT` | no | no |  |
| `MYSQL_DATABASE` | no | no |  |
| `MYSQL_HOST` | no | no |  |
| `MYSQL_LOCAL_PORT` | no | no |  |
| `MYSQL_PASSWORD` | no | no |  |
| `MYSQL_PORT` | no | no |  |
| `MYSQL_RAISE_ON_WARNINGS` | no | no |  |
| `MYSQL_SQL_MODE` | no | no |  |
| `MYSQL_SSH_ENABLE` | no | no |  |
| `MYSQL_SSH_HOST` | no | no |  |
| `MYSQL_SSH_KEY_PATH` | no | no |  |
| `MYSQL_SSH_PORT` | no | no |  |
| `MYSQL_SSH_REMOTE_HOST` | no | no |  |
| `MYSQL_SSH_REMOTE_PORT` | no | no |  |
| `MYSQL_SSH_USER` | no | no |  |
| `MYSQL_SSL_MODE` | no | no |  |
| `MYSQL_USER` | no | no |  |
| `MYSQL_USE_PURE` | no | no |  |

## FAQ

### What tools does the MySQL MCP server provide?

It exposes execute_sql to run SQL statements, get_schema_info to inspect table structure, and get_table_sample to fetch a small data sample.

### Can I query tables in more than one database?

Yes. Omit MYSQL_DATABASE to enable multi-database mode, then use fully qualified names like mydb.mytable in queries and tool arguments. Only single SQL statements are supported.

### Does the MySQL MCP server support remote or hosted deployment?

Yes. It supports STDIO and Streamable HTTP (SSE) transport, enabled with MCP_TRANSPORT=sse. The SSE mode has no built-in authentication, so put it behind an authenticating reverse proxy if exposed.

### Does it support SSH tunneling or SSL?

Yes. Set MYSQL_SSH_ENABLE=true with the SSH host, user, and key path to tunnel connections, and use MYSQL_SSL_MODE for SSL/TLS.
