Monitor and optimize your MySQL databases
DB24x7 provides comprehensive monitoring for MySQL and MariaDB databases, including query performance analysis, replication monitoring, InnoDB metrics, and real-time performance insights.
Supported Versions
MySQL 5.7+, 8.0+, MariaDB 10.3+
Real-time Monitoring
Performance Schema integration
Query Analysis
Slow query log parsing
Cloud Support
AWS RDS, Azure, GCP Cloud SQL
The Performance Schema is required for detailed query performance tracking and monitoring.
Step 1: Edit my.cnf or my.ini
[mysqld] # Enable Performance Schema performance_schema = ON # Enable specific instruments performance-schema-instrument='statement/%=ON' performance-schema-consumer-events-statements-current=ON performance-schema-consumer-events-statements-history=ON performance-schema-consumer-statements-digest=ON
Step 2: Restart MySQL
sudo systemctl restart mysql
Step 3: Verify Performance Schema is enabled
SHOW VARIABLES LIKE 'performance_schema';
Create a dedicated user with minimal required permissions for monitoring.
For MySQL 8.0+
-- Create monitoring user CREATE USER 'db24x7_monitor'@'%' IDENTIFIED BY 'your_secure_password'; -- Grant required privileges GRANT SELECT ON performance_schema.* TO 'db24x7_monitor'@'%'; GRANT SELECT ON mysql.* TO 'db24x7_monitor'@'%'; GRANT PROCESS ON *.* TO 'db24x7_monitor'@'%'; GRANT REPLICATION CLIENT ON *.* TO 'db24x7_monitor'@'%'; -- For query analysis GRANT SELECT ON information_schema.* TO 'db24x7_monitor'@'%'; -- Apply changes FLUSH PRIVILEGES;
For MySQL 5.7
-- Create monitoring user CREATE USER 'db24x7_monitor'@'%' IDENTIFIED BY 'your_secure_password'; -- Grant required privileges GRANT SELECT ON performance_schema.* TO 'db24x7_monitor'@'%'; GRANT SELECT ON mysql.* TO 'db24x7_monitor'@'%'; GRANT PROCESS ON *.* TO 'db24x7_monitor'@'%'; GRANT REPLICATION CLIENT ON *.* TO 'db24x7_monitor'@'%'; -- Apply changes FLUSH PRIVILEGES;
Security Note
Replace % with specific IP addresses or hostnames in production for better security.
Use the following connection string format to connect DB24x7 to your MySQL database:
Standard Connection String
mysql://db24x7_monitor:your_secure_password@hostname:3306/database_name
With SSL/TLS Encryption
mysql://db24x7_monitor:password@hostname:3306/dbname?ssl-mode=REQUIRED
AWS RDS MySQL Connection
mysql://db24x7_monitor:password@mydb.abc123.us-east-1.rds.amazonaws.com:3306/mysql?ssl-mode=REQUIRED
Connection Parameters
| hostname | Database server address |
| 3306 | Default MySQL port |
| ssl-mode | DISABLED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY |
| charset | Character set (default: utf8mb4) |
If you cannot connect to MySQL, verify:
bind-address in my.cnf)Verify Performance Schema is enabled:
-- Check if Performance Schema is enabled SHOW VARIABLES LIKE 'performance_schema'; -- Check enabled consumers SELECT * FROM performance_schema.setup_consumers WHERE NAME LIKE '%statements%'; -- Enable statement consumers if needed UPDATE performance_schema.setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%statements%';
Verify user privileges:
-- Check user privileges SHOW GRANTS FOR 'db24x7_monitor'@'%'; -- Verify user can connect SELECT User, Host FROM mysql.user WHERE User = 'db24x7_monitor';
Check SSL configuration:
-- Check if SSL is enabled SHOW VARIABLES LIKE '%ssl%'; -- Verify SSL connections SHOW STATUS LIKE 'Ssl_cipher';
Once your MySQL database is connected, you can: