Skip to main content

MySQL

Connect your MySQL databases to enable Tony (Database Engineer) to analyze queries, optimize performance, and monitor database health.

Supported Platforms

PlatformSupport
Self-hosted MySQL5.7, 8.0, 8.1+
MariaDB10.x
AWS RDS MySQLAll versions
AWS Aurora MySQLAll versions
Google Cloud SQLAll MySQL versions
Azure Database for MySQLFlexible Server

Setup

1

Connect as Root

Connect to MySQL as root or admin user:
mysql -h your-host -u root -p
2

Create Read-Only User

Create the CloudThinker user:
CREATE USER 'cloudthinker_readonly'@'%' IDENTIFIED BY 'your-secure-password';
3

Grant Read Permissions

Grant SELECT and monitoring privileges:
GRANT SELECT ON *.* TO 'cloudthinker_readonly'@'%';
GRANT SHOW DATABASES ON *.* TO 'cloudthinker_readonly'@'%';
GRANT PROCESS ON *.* TO 'cloudthinker_readonly'@'%';
4

Grant Performance Schema Access

Required for query analysis:
GRANT SELECT ON performance_schema.* TO 'cloudthinker_readonly'@'%';
5

Apply Changes

Flush privileges to apply changes:
FLUSH PRIVILEGES;
6

Enable Performance Schema

Verify Performance Schema is enabled:
SHOW VARIABLES LIKE 'performance_schema';
-- Should return: ON
If disabled, add to my.cnf:
[mysqld]
performance_schema = ON
7

Configure Network Access

Ensure CloudThinker can reach your database:
  • Add CloudThinker IPs to security group / firewall
  • For RDS: Enable public access or use VPC peering
8

Add Connection in CloudThinker

Navigate to Connections → MySQL and enter:
  • Host
  • Port (default: 3306)
  • Database name
  • Username: cloudthinker_readonly
  • Password
  • SSL (recommended: enabled)

Connection String Format

mysql://cloudthinker_readonly:your-secure-password@your-host:3306/database-name
Example:
mysql://cloudthinker_readonly:[email protected]:3306/production

Required Permissions

Minimum

GRANT SELECT ON your_database.* TO 'cloudthinker_readonly'@'%';
GRANT PROCESS ON *.* TO 'cloudthinker_readonly'@'%';
-- All of the above, plus:
GRANT SELECT ON performance_schema.* TO 'cloudthinker_readonly'@'%';
GRANT SELECT ON mysql.* TO 'cloudthinker_readonly'@'%';
GRANT REPLICATION CLIENT ON *.* TO 'cloudthinker_readonly'@'%';

Agent Capabilities

Once connected, Tony can:
CapabilityDescription
Query AnalysisIdentify slow queries from slow query log and Performance Schema
Index RecommendationsFind missing indexes, identify redundant indexes
Performance MetricsMonitor connections, buffer pool, query cache
Table StatisticsAnalyze table sizes, fragmentation, engine status
Replication MonitoringCheck slave status, lag, errors

Example Prompts

@tony analyze slow queries on production MySQL
@tony #dashboard database performance metrics
@tony recommend index optimizations for high-frequency queries
@tony check replication status on the read replica

Connection Options

OptionDescriptionDefault
SSLEnable SSL/TLS encryptionEnabled
Connection TimeoutSeconds to wait for connection10
Read TimeoutMax time to wait for query results30

Troubleshooting

  • Verify host and port are correct
  • Check security group / firewall allows CloudThinker IPs
  • For RDS: Ensure “Publicly accessible” is enabled or use VPC peering
  • Confirm MySQL is listening on the correct interface (bind-address)
  • Verify username and password are correct
  • Check user has correct host specification ('user'@'%' vs 'user'@'localhost')
  • Ensure GRANT statements were followed by FLUSH PRIVILEGES
  • Check with: SHOW VARIABLES LIKE 'performance_schema';
  • Enable in my.cnf and restart MySQL
  • For RDS: Modify parameter group and reboot
  • Enable slow query log: SET GLOBAL slow_query_log = 'ON';
  • Set threshold: SET GLOBAL long_query_time = 1;
  • For RDS: Modify parameter group

Security Best Practices

  • Strong passwords - Use complex, unique passwords
  • SSL encryption - Always enable SSL for connections
  • Network restrictions - Limit access to CloudThinker IPs only
  • Minimal permissions - Grant only SELECT, never write access
  • Credential rotation - Rotate passwords every 90 days