MySQL MCP Server Configuration & Usage Guide
Installationnpx
Risk LevelHigh Risk
API KeyRequired
Clients2 supported
MySQL 数据库连接,支持查询、表结构View和基本数据操作
Supported Clients
- Claude Desktop
- Cursor
Installation Command
npx -y @benborla29/mcp-server-mysqlConfiguration Example
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "<password>",
"MYSQL_DATABASE": "mydb"
}
}
}
}Environment variable required:MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE。Do not commit these values to public repositories.
Permission Scope & Security Notes
可读写 MySQL 数据库,强烈建议使用只读账号和测试数据库
- database-read
- database-write
- network-access
- credential-required
Risk Score:6/10
Common Errors
- 连接被拒绝
- 确认 MySQL 服务运行中且允许连接
- Access denied
- 检查用户名、密码和数据库权限
Sources
Recently Verified:2026-05-18。Client versions and configuration formats may change. Please refer to official documentation before use.