MySQL Setup
Connect your MySQL database to 42Cells for AI-powered analysis.
Prerequisites
- MySQL 5.7 or higher (MySQL 8.0+ recommended)
- Network access from 42Cells to your database
- A database user with read permissions
Connection Details
| Field | Description | Example |
|---|---|---|
| Host | Database server address | db.example.com or 192.168.1.100 |
| Port | MySQL port | 3306 (default) |
| Database | Database name | analytics |
| Username | Database user | readonly_user |
| Password | User password | •••••••• |
Step-by-Step Setup
1. Create a Read-Only User (Recommended)
For security, create a dedicated read-only user for 42Cells:
-- Create the user (MySQL 8.0+)
CREATE USER 'datacells_reader'@'%' IDENTIFIED BY 'your_secure_password';
-- Grant read access to a specific database
GRANT SELECT ON your_database.* TO 'datacells_reader'@'%';
-- Apply changes
FLUSH PRIVILEGES;
For MySQL 5.7:
-- Create user with password
CREATE USER 'datacells_reader'@'%' IDENTIFIED BY 'your_secure_password';
-- Grant read access
GRANT SELECT ON your_database.* TO 'datacells_reader'@'%';
-- Apply changes
FLUSH PRIVILEGES;
2. Configure Network Access
Ensure your MySQL server accepts remote connections:
For cloud-hosted databases (AWS RDS, PlanetScale, etc.):
- Add 42Cells IP addresses to your security group or authorized networks
- Contact support for our current IP ranges
For self-hosted databases:
- Edit
my.cnf(ormy.inion Windows):[mysqld]
bind-address = 0.0.0.0 - Ensure your firewall allows inbound connections on port 3306
3. SSL Configuration (Recommended)
For secure connections, enable SSL:
-- Check SSL status
SHOW VARIABLES LIKE '%ssl%';
In 42Cells connection settings, enable SSL if your server supports it.
4. Test the Connection
- Go to Connections in 42Cells
- Click New Connection → MySQL
- Enter your connection details
- Click Test Connection
- If successful, click Save
Common Issues
Connection Refused
- Verify MySQL is running:
sudo systemctl status mysql - Check
bind-addressinmy.cnf(should be0.0.0.0for remote access) - Ensure the port is correct (default: 3306)
Access Denied
- Verify username and password
- Check the user host pattern matches (use
'%'for any host) - View existing users:
SELECT user, host FROM mysql.user;
Host Not Allowed
The user might be restricted to specific hosts:
-- Update user to allow connections from any host
RENAME USER 'datacells_reader'@'localhost' TO 'datacells_reader'@'%';
FLUSH PRIVILEGES;
Authentication Plugin Issues (MySQL 8.0)
MySQL 8.0 uses caching_sha2_password by default. If you have connection issues:
-- Switch to mysql_native_password
ALTER USER 'datacells_reader'@'%'
IDENTIFIED WITH mysql_native_password BY 'your_secure_password';
FLUSH PRIVILEGES;
Permission Denied
Ensure the user has SELECT privileges:
-- Check current privileges
SHOW GRANTS FOR 'datacells_reader'@'%';
Performance Tips
- Use connection pooling for frequent queries
- Consider read replicas for heavy analytics workloads
- Index columns used in WHERE clauses and JOINs
- For large tables, ensure statistics are up to date:
ANALYZE TABLE table_name;