You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**When to use**: When you want to use the latest version without installing it globally
115
115
-**Pros**: No global installation required, all configuration in one file
116
-
-**Cons**: More complex configuration, credentials in MCP file (which may be preferred in some cases)
116
+
-**Cons**: More complex configuration
117
117
118
118
Choose the approach that best fits your workflow. Both methods will work correctly with any AI assistant that supports MCP.
119
119
120
-
**Important Configuration Notes:**
120
+
### Important Configuration Notes
121
+
121
122
- You must use the full environment names: LOCAL_, DEVELOPMENT_, STAGING_, PRODUCTION_
122
123
- Abbreviations like DEV_ or PROD_ will not work
123
124
- Global settings like DEBUG, MCP_MYSQL_SSL apply to all environments
124
125
- At least one environment (typically "local") must be configured
125
126
- You only need to configure the environments you plan to use
126
-
127
-
### 2. Alternative: Using a .env File
128
-
129
-
If you prefer to keep your database credentials in a separate file, you can use a `.env` file:
130
-
131
-
```env
132
-
# Local Database
133
-
LOCAL_DB_HOST=localhost
134
-
LOCAL_DB_USER=root
135
-
LOCAL_DB_PASS=your_password
136
-
LOCAL_DB_NAME=your_database
137
-
LOCAL_DB_PORT=3306
138
-
LOCAL_DB_SSL=false
139
-
140
-
# Development Database (optional)
141
-
DEVELOPMENT_DB_HOST=dev.example.com
142
-
DEVELOPMENT_DB_USER=dev_user
143
-
DEVELOPMENT_DB_PASS=dev_password
144
-
DEVELOPMENT_DB_NAME=dev_database
145
-
DEVELOPMENT_DB_PORT=3306
146
-
DEVELOPMENT_DB_SSL=true
147
-
148
-
# Staging Database (optional)
149
-
STAGING_DB_HOST=staging.example.com
150
-
STAGING_DB_USER=staging_user
151
-
STAGING_DB_PASS=staging_password
152
-
STAGING_DB_NAME=staging_database
153
-
STAGING_DB_PORT=3306
154
-
STAGING_DB_SSL=true
155
-
156
-
# Production Database (optional)
157
-
PRODUCTION_DB_HOST=prod.example.com
158
-
PRODUCTION_DB_USER=prod_user
159
-
PRODUCTION_DB_PASS=prod_password
160
-
PRODUCTION_DB_NAME=prod_database
161
-
PRODUCTION_DB_PORT=3306
162
-
PRODUCTION_DB_SSL=true
163
-
164
-
# Debug Mode
165
-
DEBUG=false
166
-
```
167
-
168
-
**Important:** The `.env` file must be placed in the current working directory from where you run the MySQL MCP server. The server will automatically look for a `.env` file in this location. If you're using:
169
-
170
-
-**Global installation**: The `.env` file should be in the directory where you run the commands
171
-
-**NPX method**: The `.env` file should be in the directory where you run `npx mysql-query-mcp-server`
172
-
-**MCP command method**: You can skip the `.env` file entirely and use the embedded environment variables
173
-
174
-
You can copy the included `.env.example` file to get started:
175
-
```bash
176
-
cp .env.example .env
177
-
```
178
-
179
-
When using a `.env` file, your MCP configuration can be simplified to:
180
-
181
-
```json
182
-
{
183
-
"mysql": {
184
-
"name": "MySQL Query MCP",
185
-
"description": "MySQL read-only query access through MCP",
186
-
"type": "bin",
187
-
"enabled": true,
188
-
"bin": "mysql-query-mcp"
189
-
}
190
-
}
191
-
```
127
+
- For security reasons, consider using environment variables or secure credential storage for production credentials
192
128
193
129
## Configuration Options
194
130
@@ -250,7 +186,11 @@ Use the info tool to check the status of our production database.
250
186
251
187
#### 3. environments
252
188
253
-
List all configured environments from your `.env` file.
189
+
List all configured environments from your configuration:
190
+
191
+
```
192
+
Use the environments tool to show me which database environments are available.
193
+
```
254
194
255
195
## Available Tools
256
196
@@ -282,7 +222,7 @@ Get detailed information about your database:
282
222
283
223
### 3. environments
284
224
285
-
List all configured environments from your setup:
225
+
List all configured environments from your configuration:
286
226
287
227
```
288
228
Use the environments tool to show me which database environments are available.
@@ -294,19 +234,18 @@ Use the environments tool to show me which database environments are available.
294
234
- ✅ Each environment has its own isolated connection pool
295
235
- ✅ SSL connections are supported for production environments
296
236
- ✅ Query timeouts prevent runaway operations
297
-
- ⚠️ Keep your `.env` file secure and never commit it to source control
237
+
- ⚠️ Consider using secure credential management for database credentials
298
238
299
239
## Troubleshooting
300
240
301
241
### Connection Issues
302
242
303
243
If you're having trouble connecting:
304
244
305
-
1. Verify your database credentials in `.env` or your MCP configuration
306
-
2. Check the location of your `.env` file (it must be in the current working directory)
307
-
3. Ensure the MySQL server is running and accessible
308
-
4. Check for firewall rules blocking connections
309
-
5. Enable debug mode for detailed logs: `DEBUG=true mysql-query-mcp`
245
+
1. Verify your database credentials in your MCP configuration
246
+
2. Ensure the MySQL server is running and accessible
247
+
3. Check for firewall rules blocking connections
248
+
4. Enable debug mode by setting DEBUG=true in your configuration
0 commit comments