mysql-mcp-server
Allows querying and exploring a MySQL database, including executing SELECT queries, listing tables, and describing table schemas.
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 the database."
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 MCP Server
A Model Context Protocol (MCP) server that connects Claude Code to MySQL databases. Once configured, you can query your database using natural language directly in Claude Code.
Features
query: Execute SELECT queries on your MySQL database
list_tables: List all tables in the database
describe_table: Get the schema/structure of a specific table
Related MCP server: MCP MySQL Server
Quick Start
Choose one of the installation methods below, then add the configuration to Claude Code.
Option 1: Using npx
No installation needed. Add this to your Claude Code config:
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mysql-mcp-server"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Option 2: Install globally from npm
npm install -g mysql-mcp-serverThen add this to your Claude Code config:
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "mysql-mcp-server",
"args": [],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Option 3: Clone from GitHub
git clone https://github.com/Nordstrom-Sandbox/mysql-mcp-server.git
cd mysql-mcp-server
npm installThen add this to your Claude Code config (use the actual path where you cloned it):
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "node",
"args": ["/full/path/to/mysql-mcp-server/index.js"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Configuration
Claude Code Config Location
macOS/Linux:
~/.claude.jsonWindows:
%USERPROFILE%\.claude.json
Environment Variables
Variable | Description | Default |
| MySQL server hostname | localhost |
| MySQL server port | 3306 |
| MySQL username | root |
| MySQL password | (empty) |
| Database name | (required) |
Restart Claude Code
After adding the configuration, restart Claude Code for the changes to take effect. Claude Code automatically starts and manages the MCP server - you don't need to run it manually.
Usage Examples
Once configured, just talk to Claude naturally:
"Show me all the tables in the database"
"What's the schema of the users table?"
"Show me the first 10 users"
"Update the status to 'active' for user_id 123"
Security Notes
Never commit credentials to version control
Use read-only database users when possible
The
querytool only allows SELECT statementsThe
executetool can run INSERT/UPDATE/DELETE - use with caution
Troubleshooting
Connection Issues
Verify MySQL is running
Check credentials are correct
Ensure the database exists
Check firewall settings for remote servers
Look at Claude Code logs for error messages
Permission Issues
Ensure the MySQL user has appropriate grants for the database
Check that the database name is correct
For Contributors
Development Setup
git clone https://github.com/Nordstrom-Sandbox/mysql-mcp-server.git
cd mysql-mcp-server
npm installTesting Locally
MYSQL_HOST=localhost \
MYSQL_USER=root \
MYSQL_PASSWORD=your_password \
MYSQL_DATABASE=your_database \
node index.jsThe server communicates via stdio using the MCP protocol.
Changelog
See CHANGELOG.md for version history.
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
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Sharat005/mysql-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server