MySQL
MySQL Database Connection
Section titled “MySQL Database Connection”MySQL is one of the most popular relational databases. Datablast connects to MySQL servers using standard connection parameters. This guide covers how to gather and configure the required credentials.
1. Required Connection Information
Section titled “1. Required Connection Information”Essential Parameters
Section titled “Essential Parameters”| Parameter | Description | Default |
|---|---|---|
| Host | MySQL server address (localhost, IP, or domain name) | localhost |
| Port | MySQL server port number | 3306 |
| Schema | Database name you want to connect to | - |
| User | MySQL username with appropriate permissions | - |
| Password | Password for the MySQL user | - |
Connection String Format
Section titled “Connection String Format”mysql://user:password@host:port/schema2. Gathering MySQL Credentials
Section titled “2. Gathering MySQL Credentials”From Your Database Administrator
Section titled “From Your Database Administrator”Contact your DBA for:
- Server hostname or IP address
- Database name (schema)
- Username and password
- Port number (if different from 3306)
- SSL requirements
From Cloud Providers
Section titled “From Cloud Providers”PlanetScale:
- Connection strings available in dashboard
- Uses SSL/TLS by default
- Provides branch-specific credentials
Azure Database for MySQL:
- Server name:
servername.mysql.database.azure.com - Username format:
username@servername - SSL connection required
AWS RDS MySQL:
- Endpoint available in RDS console
- Standard MySQL authentication
- Security group configuration required
Google Cloud SQL:
- Instance connection name format
- Public IP or private IP options
- Cloud SQL Proxy available for secure connections
3. Testing Connection via Command Line
Section titled “3. Testing Connection via Command Line”Basic Connection Command
Section titled “Basic Connection Command”mysql --host=HOST --port=PORT --user=USER --password --database=SCHEMAShort Form Options
Section titled “Short Form Options”mysql -h HOST -P PORT -u USER -p SCHEMAExamples
Section titled “Examples”Local MySQL:
mysql -h localhost -P 3306 -u myuser -p mydatabaseRemote MySQL:
mysql -h db.example.com -P 3306 -u appuser -p production_dbWith SSL:
mysql -h secure-db.com -P 3306 -u user -p --ssl-mode=REQUIRED database💡 Security Tip: Use
-pwithout the password to enter it securely when prompted. Never include passwords in command history.
4. Configure Datablast Connection
Section titled “4. Configure Datablast Connection”Connection Form Fields
Section titled “Connection Form Fields”| Field | Example Value | Notes |
|---|---|---|
| Connection Name | Production MySQL | Friendly name for the UI |
| Host | db.mycompany.com | Server address or IP |
| Port | 3306 | Usually 3306 for MySQL |
| Schema | analytics_db | Database name |
| User | datablast_user | MySQL username |
| Password | •••••••••••• | User password (hidden) |
| Description | Main analytics database | Optional connection notes |
Advanced Options
Section titled “Advanced Options”SSL Configuration:
- Enable if your MySQL server requires encrypted connections
- Common for cloud-hosted databases
Connection Pool:
- Configure max connections if needed
- Useful for high-traffic applications
5. Security Best Practices
Section titled “5. Security Best Practices”User Permissions
Section titled “User Permissions”Create a dedicated MySQL user for Datablast:
-- Create userCREATE USER 'datablast'@'%' IDENTIFIED BY 'secure_password';
-- Grant necessary permissionsGRANT SELECT ON analytics_db.* TO 'datablast'@'%';
-- For specific tables onlyGRANT SELECT ON analytics_db.users TO 'datablast'@'%';GRANT SELECT ON analytics_db.orders TO 'datablast'@'%';
-- Apply changesFLUSH PRIVILEGES;Connection Security
Section titled “Connection Security”- Use SSL/TLS: Enable encrypted connections for remote databases
- Limit Host Access: Restrict user to specific IP addresses
- Minimal Permissions: Grant only SELECT permissions unless write access is needed
- Strong Passwords: Use complex passwords or certificate-based authentication
Firewall Configuration
Section titled “Firewall Configuration”Ensure your MySQL server allows connections from Datablast:
- Add Datablast IP to allowlist
- Configure security groups (AWS/Azure)
- Update iptables rules if applicable
6. Configuration File Alternative
Section titled “6. Configuration File Alternative”Using MySQL Option Files
Section titled “Using MySQL Option Files”Instead of entering credentials each time, create a configuration file:
Linux/macOS (~/.my.cnf):
[client]host=db.example.comport=3306user=datablast_userpassword=your_passworddatabase=analytics_dbWindows (C:\Users\username\.my.cnf):
[client]host=db.example.comport=3306user=datablast_userpassword=your_passworddatabase=analytics_db⚠️ Security: Protect configuration files with proper file permissions (chmod 600 on Unix systems).
7. Troubleshooting
Section titled “7. Troubleshooting”Connection Refused
Section titled “Connection Refused”- Check if MySQL is running:
systemctl status mysql - Verify port:
netstat -tlnp | grep 3306 - Test network connectivity:
telnet host 3306
Access Denied
Section titled “Access Denied”- Verify credentials: Double-check username and password
- Check user permissions: Ensure user has database access
- Host restrictions: Confirm user can connect from your IP
SSL/TLS Issues
Section titled “SSL/TLS Issues”- SSL requirement: Some servers require SSL connections
- Certificate validation: May need to disable strict SSL verification
- Protocol versions: Ensure compatible TLS versions
Performance Issues
Section titled “Performance Issues”- Connection pooling: Implement connection limits
- Query optimization: Use EXPLAIN to analyze slow queries
- Index usage: Ensure proper indexing on queried tables
8. Common Cloud Provider Settings
Section titled “8. Common Cloud Provider Settings”Amazon RDS
Section titled “Amazon RDS”Host: mydb.cluster-xyz.us-east-1.rds.amazonaws.comPort: 3306SSL: RequiredGoogle Cloud SQL
Section titled “Google Cloud SQL”Host: 1.2.3.4 (Public IP)Port: 3306SSL: RecommendedAzure Database for MySQL
Section titled “Azure Database for MySQL”Host: myserver.mysql.database.azure.comPort: 3306User: username@myserverSSL: RequiredUseful Links
Section titled “Useful Links”Always use encrypted connections for production databases and follow the principle of least privilege when creating database users.