MyDBA is an AI-powered VSCode extension that brings database management, monitoring, and optimization directly into your development environment. Built for developers and database administrators who want intelligent insights without leaving their IDE.
- Multi-Database Support: MySQL 8.0+, MariaDB 10.6+ (GA versions only)
- AI-Powered Query Analysis: Multi-provider support (VSCode LM, OpenAI, Anthropic, Ollama)
- Visual EXPLAIN Plans: Interactive tree diagrams with pain point highlighting
- Query Profiling: Performance Schema integration with waterfall charts
- Database Explorer: Tree view with databases, tables, indexes, and processes
- Enhanced Process List: Transaction detection with grouping by user/host/query
- Security-First Design: Credential isolation, production safeguards, query anonymization
- Documentation-Grounded AI: RAG system with MySQL/MariaDB docs to reduce hallucinations
- Editor Compatibility: Works in VSCode, Cursor, Windsurf, and VSCodium
- Comprehensive Testing: Integration tests with Docker, 70%+ code coverage
Real-time monitoring dashboard showing:
- Server information (version, uptime)
- Connections over time (current vs max)
- Queries per second with slow query detection
- Buffer pool hit rate
- Thread activity (running vs connected)
- VSCode: 1.85.0 or higher (also supports Cursor, Windsurf, VSCodium)
- Node.js: 18.x or higher (for development)
- MySQL: 8.0+ (LTS and Innovation releases)
- MariaDB: 10.6+, 10.11 LTS, 11.x+ (GA versions only)
MyDBA requires Performance Schema to be enabled for monitoring features like:
- Query profiling and execution analysis
- Slow query detection
- Queries without indexes detection
- Transaction monitoring
- Process list with transaction details
Enable Performance Schema:
For MySQL 8.0+:
# In my.cnf or my.ini
[mysqld]
performance_schema = ONFor MariaDB 10.6+:
# In my.cnf or mariadb.conf.d/50-server.cnf
[mysqld]
performance_schema = ON
performance-schema-instrument = '%=ON'
performance-schema-consumer-events-statements-current = ON
performance-schema-consumer-events-statements-history = ONRestart your database server after making configuration changes.
Verify Performance Schema is enabled:
SHOW VARIABLES LIKE 'performance_schema';Should return: performance_schema | ON
The database user needs the following privileges for full functionality:
-- Process monitoring (required for process list)
GRANT PROCESS ON *.* TO 'mydba_user'@'%';
-- Database listing
GRANT SHOW DATABASES ON *.* TO 'mydba_user'@'%';
-- Metadata access (for schema information)
GRANT SELECT ON mysql.* TO 'mydba_user'@'%';
-- Performance Schema access (for monitoring and profiling)
-- UPDATE privilege is needed to configure instruments and consumers
GRANT SELECT, UPDATE ON performance_schema.* TO 'mydba_user'@'%';
-- Optional: Replication monitoring
GRANT REPLICATION CLIENT ON *.* TO 'mydba_user'@'%';
-- Database-specific access (adjust as needed)
GRANT SELECT, INSERT, UPDATE, DELETE ON your_database.* TO 'mydba_user'@'%';
-- Apply changes
FLUSH PRIVILEGES;Note: MyDBA automatically configures Performance Schema instruments and consumers when you use profiling features. The UPDATE privilege on performance_schema.* is required for this auto-configuration.
Quick Links:
- π Database Setup Guide - Detailed setup instructions
- β‘ Quick Reference - Quick setup checklist and commands
- π§ͺ Testing Guide - Docker setup for development
# Install from VSCode marketplace
code --install-extension mydba.mydba# Clone repository
git clone https://github.com/your-org/mydba.git
cd mydba
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Package extension
npm run package
# Install locally
npm run install-extensionBefore connecting, ensure:
- β Performance Schema is enabled in your database (see Database Setup Guide)
- β User has required permissions (PROCESS, SELECT on performance_schema.*, etc.)
- β Database version is supported (MySQL 8.0+ or MariaDB 10.6+)
Quick verification:
-- Check Performance Schema
SHOW VARIABLES LIKE 'performance_schema'; -- Must return 'ON'
-- Check your permissions
SHOW GRANTS FOR CURRENT_USER();-
Connect to Database
- Open Command Palette (
Ctrl+Shift+P) - Run
MyDBA: New Connection - Enter connection details (host, port, username, password)
- Choose environment (dev/staging/prod)
- Open Command Palette (
-
Explore Database
- View databases and tables in the MyDBA sidebar
- Click to expand and explore schema
- Right-click for context actions
-
View Metrics Dashboard
- Click "Metrics Dashboard" in the sidebar
- Monitor real-time database performance
- Track connections, queries, buffer pool, and threads
-
Analyze Queries
- Select SQL query in editor
- Run
MyDBA: Analyze Queryor use@mydba /analyze - View AI-powered insights and recommendations
-
Visual EXPLAIN Plans
- Run
MyDBA: Explain Query - See interactive tree diagram
- Identify performance bottlenecks
- Apply one-click fixes
- Run
-
Profile Slow Queries
- Run
MyDBA: Profile Query - View execution stages with waterfall chart
- Identify time-consuming operations
- Run
MyDBA supports multiple AI providers for maximum compatibility:
| Provider | Editors | Cost | Privacy | Setup Required |
|---|---|---|---|---|
| GitHub Copilot (VSCode LM API) | VSCode only | Included with Copilot subscription | Data sent to GitHub | Automatic (no config) |
| OpenAI | All editors | Pay-per-use (~$0.0015/1K tokens) | Data sent to OpenAI | API key required |
| Anthropic Claude | All editors | Pay-per-use (~$0.003/1K tokens) | Data sent to Anthropic | API key required |
| Ollama | All editors | Free | 100% local, no data sent | Local installation |
Set mydba.ai.provider to "auto" (default) and MyDBA will automatically use the best available provider in this order:
- VSCode Language Model (if available)
- Configured API keys (OpenAI β Anthropic)
- Ollama (if running locally)
- Prompt to configure
No configuration needed! If you have GitHub Copilot, MyDBA will automatically use it.
- Get API key from platform.openai.com
- Open Command Palette (
Ctrl+Shift+P) - Run
MyDBA: Configure AI Provider - Select "OpenAI" and enter your API key
- Choose model (default: gpt-4o-mini)
- Get API key from console.anthropic.com
- Open Command Palette (
Ctrl+Shift+P) - Run
MyDBA: Configure AI Provider - Select "Anthropic" and enter your API key
- Choose model (default: claude-3-5-sonnet)
- Install Ollama from ollama.ai
- Pull a model:
ollama pull llama3.1 - MyDBA will auto-detect Ollama running on
localhost:11434 - Configure custom endpoint in settings if needed
Note for Cursor/Windsurf Users: VSCode Language Model API is not available in VSCode forks. Use OpenAI, Anthropic, or Ollama instead.
{
"mydba.ai.enabled": true,
"mydba.ai.provider": "auto",
"mydba.ai.anonymizeQueries": true,
"mydba.ai.includeSchemaContext": true,
"mydba.ai.openaiModel": "gpt-4o-mini",
"mydba.ai.anthropicModel": "claude-3-5-sonnet-20241022",
"mydba.ai.ollamaEndpoint": "http://localhost:11434",
"mydba.ai.ollamaModel": "llama3.1"
}{
"mydba.confirmDestructiveOperations": true,
"mydba.warnMissingWhereClause": true,
"mydba.safeMode": true,
"mydba.preview.maxRows": 1000,
"mydba.dml.maxAffectRows": 1000
}{
"mydba.refreshInterval": 5000,
"mydba.slowQueryThreshold": 1000,
"mydba.queryTimeout": 30000,
"mydba.maxConnections": 10
}Use @mydba in VSCode Chat for natural language database assistance:
@mydba /analyze SELECT * FROM users WHERE email = 'test@example.com'
@mydba /explain SELECT * FROM orders WHERE created_at > '2024-01-01'
@mydba /profile SELECT COUNT(*) FROM large_table
@mydba how do I optimize this slow query?
@mydba what indexes should I add to the users table?
- Local Processing: Schema metadata and query results stay local
- AI Anonymization: Queries templated (
<table:name>,<col:name>,?) before sending to AI - Credential Security: Stored in OS keychain (Keychain/Credential Manager)
- No Data Collection: Telemetry disabled by default
- Destructive Operations: Confirmation required for DROP/TRUNCATE/DELETE/UPDATE
- Missing WHERE Warnings: Alerts for UPDATE/DELETE without WHERE clause
- Row Limits: Previews capped at 1,000 rows, DML operations blocked if > 1,000 rows
- Environment Awareness: Stricter rules for production connections
- Service Container: Dependency injection for testability
- Database Adapters: Pluggable architecture for multi-database support
- AI Service Coordinator: VSCode LM API integration with RAG
- Webview Providers: Interactive EXPLAIN and profiling viewers
- Security Layer: Credential management and safety validators
- Core: TypeScript, Node.js, VSCode Extension API
- Database: mysql2 (MySQL/MariaDB), pg (PostgreSQL), ioredis (Redis)
- AI: VSCode Language Model API, VSCode Chat API
- UI: Webview UI Toolkit, D3.js, Plotly.js, Chart.js
- Security: VSCode SecretStorage, SSL/TLS, SQL injection prevention
# Run unit tests
npm test
# Run integration tests (requires Docker)
npm run test:integration
# Run linting
npm run lint
# Run all tests
npm run pretest# Start test databases
docker-compose -f docker-compose.test.yml up -d
# Run tests
npm run test:integration
# Cleanup
docker-compose -f docker-compose.test.yml down- Extension activation: < 500ms
- Connection test: < 2s
- Tree view refresh: < 200ms
- EXPLAIN visualization: < 300ms
- AI analysis: < 3s
- Memory (idle): 50MB
- Memory (active): 200MB
- CPU (idle): 0%
- CPU (active): 5%
- Concurrent connections: 10
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
# Clone and install
git clone https://github.com/your-org/mydba.git
cd mydba
npm install
# Start development
npm run watch
# In another terminal, open VSCode
code .
# Press F5 to launch Extension Development Host- TypeScript with strict mode
- ESLint configuration
- Prettier formatting
- Comprehensive tests (unit + integration)
Licensed under the Apache License, Version 2.0. See LICENSE for details.
IMPORTANT: This software is provided "as is" without warranty of any kind. Users are responsible for:
- Testing in non-production environments first
- Understanding the impact of suggested optimizations
- Backing up data before applying changes
- Monitoring database performance after changes
See SECURITY.md for security policies and supported versions.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation:
- Inspired by vscode-kafka-client
- Built with VSCode Extension API
- AI powered by VSCode Language Model API
Made with β€οΈ for the database community

