mysql-mcp-server
Provides tools for managing MariaDB databases, covering the full lifecycle of database administration, development, and operations including schema management, data operations, user management, monitoring, and query analysis.
Provides tools for managing MySQL databases, covering the full lifecycle of database administration, development, and operations including schema management, data operations, user management, monitoring, and query analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mysql-mcp-serverlist all tables in database mydb"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MySQL/MariaDB MCP Server
Complete MCP server for MySQL and MariaDB. 50 tools covering the full lifecycle of database administration, development, and operations.
Quick Start (Docker)
cp .env.example .env
# Edit .env with your settings
docker compose up -dMCP server: http://localhost:4000/mcp
Health: http://localhost:4000/health
MariaDB: localhost:3307
Related MCP server: MCP MySQL Server
Configuration
Variable | Default | Description |
|
| MySQL host |
|
| MySQL port |
|
| MySQL user |
|
| MySQL password |
|
| Default database |
|
| Root password (Docker only) |
|
|
|
|
| HTTP server port |
|
| Host port for MySQL container |
|
| Host port for MCP container |
Claude Desktop / Claude Code Integration
HTTP Transport
{
"mcpServers": {
"mysql": {
"url": "http://localhost:4000/mcp"
}
}
}stdio Transport (local)
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/path/to/mcp-mysql/dist/index.js"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password"
}
}
}
}Tools (50 total)
Databases (5)
Tool | Description |
| List all databases |
| Create a database |
| Drop a database |
| Show CREATE DATABASE statement |
| Server version, uptime, config |
Tables (8)
Tool | Description |
| List tables with stats |
| Column definitions (SHOW FULL COLUMNS) |
| Full CREATE TABLE DDL |
| Create table from SQL |
| Drop one or more tables |
| Remove all rows |
| Rename / move between databases |
| Size, rows, engine, collation |
Columns (4)
Tool | Description |
| ALTER TABLE ADD COLUMN |
| ALTER TABLE DROP COLUMN |
| ALTER TABLE MODIFY COLUMN |
| RENAME COLUMN (MySQL 8+/MariaDB 10.5+) |
Indexes (3)
Tool | Description |
| All indexes with cardinality |
| Create BTREE/HASH/FULLTEXT/SPATIAL index |
| Drop an index |
Foreign Keys (3)
Tool | Description |
| List FK constraints |
| Add FK with ON UPDATE/DELETE rules |
| Drop FK constraint |
Data Operations (7)
Tool | Description |
| SELECT with pagination and parameterized values |
| Execute any SQL (DDL/DML) |
| Insert single row |
| Update rows by WHERE condition |
| Delete rows by WHERE condition |
| Batch insert up to 5000 rows |
| Atomic multi-statement transaction |
User Management (7)
Tool | Description |
| List all MySQL accounts |
| Create user with password |
| Drop user |
| Grant privileges |
| Revoke privileges |
| Show GRANT statements |
| Change user password |
Server Monitoring (6)
Tool | Description |
| Global/session status variables |
| Global/session config variables |
| Active connections and queries |
| Kill connection or query |
| Last statement warnings |
| Reload grant tables |
Query Analysis & Maintenance (5)
Tool | Description |
| EXPLAIN with traditional/JSON/TREE format |
| Update optimizer statistics |
| Defragment and reclaim space |
| Check for corruption |
| Repair MyISAM/ARCHIVE tables |
Export & Import (2)
Tool | Description |
| Export as JSON, CSV, or SQL INSERTs |
| Execute SQL script |
Development
npm install
npm run dev # Development with auto-reload
npm run build # Production buildSwitch to MySQL 8.4
Edit docker-compose.yml:
mysql:
image: mysql:8.4 # was mariadb:11.4
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpassword}
MYSQL_DATABASE: ${MYSQL_DATABASE:-mcpdb}
MYSQL_USER: ${MYSQL_USER:-mcpuser}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-mcppassword}This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jordiHikefoxter/mcp-mysql'
If you have feedback or need assistance with the MCP directory API, please join our Discord server