Connect MySQL
Connect Horizon Epoch to MySQL databases.
CLI Configuration
# Add MySQL storage backend
epoch storage add mydb \
--type mysql \
--url "mysql://user:pass@localhost:3306/database"
Connection String Format
mysql://[user[:password]@][host][:port]/database[?param=value&...]
Common parameters:
ssl-mode- disabled, preferred, required, verify_ca, verify_identityssl-ca- Path to CA certificateconnect_timeout- Connection timeout in seconds
SSL/TLS Modes
| Mode | Description |
|---|---|
disabled | No SSL |
preferred | Use SSL if available (default) |
required | Require SSL, don’t verify certificate |
verify_ca | Require SSL, verify CA |
verify_identity | Require SSL, verify CA and hostname |
With SSL
epoch storage add mydb \
--type mysql \
--url "mysql://user:pass@host/db?ssl-mode=required"
With Certificate Verification
epoch storage add mydb \
--type mysql \
--url "mysql://user:pass@host/db?ssl-mode=verify_ca&ssl-ca=/path/to/ca.pem"
Register Tables
epoch table add customers \
--location "mysql://mydb/customers"
SSH Tunnel Support
MySQL connections support SSH tunneling for secure access:
epoch storage add mydb \
--type mysql \
--url "mysql://user:pass@localhost:3306/db" \
--ssh-host "bastion.example.com" \
--ssh-user "ec2-user" \
--ssh-key "~/.ssh/id_rsa"
See SSH Tunnels for more details.
AWS RDS MySQL
# Standard connection
epoch storage add rds \
--type mysql \
--url "mysql://admin:pass@mydb.cluster.us-east-1.rds.amazonaws.com:3306/mydb?ssl-mode=required"
For IAM authentication, see AWS Secrets.
Troubleshooting
Connection Refused
- Verify MySQL is running and accepting connections
- Check host, port, and firewall rules
- Verify user has remote access permissions
SSL Errors
- Ensure SSL mode matches server configuration
- For self-signed certs, use
verify_cawithssl-caparameter
Authentication Failed
- Verify username and password
- Check user has access from your host (
'user'@'%'vs'user'@'localhost')