Skip to content

MySQL

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.


ParameterDescriptionDefault
HostMySQL server address (localhost, IP, or domain name)localhost
PortMySQL server port number3306
SchemaDatabase name you want to connect to-
UserMySQL username with appropriate permissions-
PasswordPassword for the MySQL user-
mysql://user:password@host:port/schema

Contact your DBA for:

  • Server hostname or IP address
  • Database name (schema)
  • Username and password
  • Port number (if different from 3306)
  • SSL requirements

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

Terminal window
mysql --host=HOST --port=PORT --user=USER --password --database=SCHEMA
Terminal window
mysql -h HOST -P PORT -u USER -p SCHEMA

Local MySQL:

Terminal window
mysql -h localhost -P 3306 -u myuser -p mydatabase

Remote MySQL:

Terminal window
mysql -h db.example.com -P 3306 -u appuser -p production_db

With SSL:

Terminal window
mysql -h secure-db.com -P 3306 -u user -p --ssl-mode=REQUIRED database

💡 Security Tip: Use -p without the password to enter it securely when prompted. Never include passwords in command history.


FieldExample ValueNotes
Connection NameProduction MySQLFriendly name for the UI
Hostdb.mycompany.comServer address or IP
Port3306Usually 3306 for MySQL
Schemaanalytics_dbDatabase name
Userdatablast_userMySQL username
Password••••••••••••User password (hidden)
DescriptionMain analytics databaseOptional connection notes

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

Create a dedicated MySQL user for Datablast:

-- Create user
CREATE USER 'datablast'@'%' IDENTIFIED BY 'secure_password';
-- Grant necessary permissions
GRANT SELECT ON analytics_db.* TO 'datablast'@'%';
-- For specific tables only
GRANT SELECT ON analytics_db.users TO 'datablast'@'%';
GRANT SELECT ON analytics_db.orders TO 'datablast'@'%';
-- Apply changes
FLUSH PRIVILEGES;
  • 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

Ensure your MySQL server allows connections from Datablast:

  • Add Datablast IP to allowlist
  • Configure security groups (AWS/Azure)
  • Update iptables rules if applicable

Instead of entering credentials each time, create a configuration file:

Linux/macOS (~/.my.cnf):

[client]
host=db.example.com
port=3306
user=datablast_user
password=your_password
database=analytics_db

Windows (C:\Users\username\.my.cnf):

[client]
host=db.example.com
port=3306
user=datablast_user
password=your_password
database=analytics_db

⚠️ Security: Protect configuration files with proper file permissions (chmod 600 on Unix systems).


  • Check if MySQL is running: systemctl status mysql
  • Verify port: netstat -tlnp | grep 3306
  • Test network connectivity: telnet host 3306
  • 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 requirement: Some servers require SSL connections
  • Certificate validation: May need to disable strict SSL verification
  • Protocol versions: Ensure compatible TLS versions
  • Connection pooling: Implement connection limits
  • Query optimization: Use EXPLAIN to analyze slow queries
  • Index usage: Ensure proper indexing on queried tables

Host: mydb.cluster-xyz.us-east-1.rds.amazonaws.com
Port: 3306
SSL: Required
Host: 1.2.3.4 (Public IP)
Port: 3306
SSL: Recommended
Host: myserver.mysql.database.azure.com
Port: 3306
User: username@myserver
SSL: Required

Always use encrypted connections for production databases and follow the principle of least privilege when creating database users.