Connect MySQL
Datarelix connects to MySQL through a read-only query service. All queries are validated and executed inside that service — the model never sees credentials or executes raw SQL against your database.
Prerequisites
- A MySQL server on a supported release; confirm the deployed version and authentication policy.
- A read-only MySQL user with
SELECTon the database you want to analyze. - Network reachability from Datarelix’s egress IPs to your MySQL server.
Auth modes
Username & password
Standard MySQL authentication using a username and password. The password is stored encrypted; all other connection fields are stored as plain configuration. Check the server authentication plugin and TLS configuration. Modern MySQL uses caching_sha2_password; legacy mysql_native_password availability depends on version and must not be assumed.
Setup — create a read-only user
Run the following in your MySQL instance (with an administrator authorised to create users and grant the selected table permissions):
CREATE USER 'datarelix_reader'@'%' IDENTIFIED BY 'choose-a-strong-password';GRANT SELECT ON your_db.* TO 'datarelix_reader'@'%';Replace your_db with your actual database name. The '%' host wildcard allows connections from any IP — you can restrict it to a specific CIDR if your MySQL server enforces host-based access control. See the MySQL GRANT reference for the full privilege model.
Where to find your credentials
| Field | Where to get it |
|---|---|
| Host | Your cloud console — AWS RDS: instance endpoint; GCP Cloud SQL: public/private IP; Azure Database for MySQL: server hostname (*.mysql.database.azure.com) |
| Port | Default 3306; visible under the connection info panel in your cloud console |
| Database | The database name — list with SHOW DATABASES; in the MySQL CLI |
| Username | The user you created above |
| Password | The password you set in CREATE USER |
What to enter
Host: your-host.example.comPort: 3306Database: your_dbUsername: datarelix_readerPassword: ••••••••Connection string
Paste a mysql:// URL instead of filling individual fields.
Where to find your connection string
- AWS RDS — RDS console → your DB instance → Connectivity & security → copy the endpoint, then build:
mysql://datarelix_reader:password@endpoint:3306/dbname - PlanetScale — Dashboard → your database → Connect → copy the connection details
- Railway / Render — connection details panel in your project’s database service
What to enter
mysql://datarelix_reader:your-password@your-host.example.com:3306/your_dbScope semantics
MySQL has no schema concept separate from the database — the database is the scope. The connection is restricted to the single database you specify.
To analyze multiple databases on the same MySQL server, create one connection per database.
Discovery
Fully supported. Discovery reads INFORMATION_SCHEMA to list tables, columns, primary keys and foreign keys.
Vitess / PlanetScale: Vitess-backed databases often don’t enforce (or expose) foreign-key constraints, so discovery returns an empty relationship graph. Missing declared relationships require review of any inferred joins.
Limitations
- One database per connection.
- No write or DDL queries — Datarelix rejects any statement that is not a read before it runs.
- Table names on Linux MySQL are case-sensitive by default (
lower_case_table_names=0); on Windows/macOS they’re case-insensitive. Discovery shows names as MySQL stores them. - Results are capped at 5,000 rows — queries without a
LIMITget one added automatically.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Access denied for user 'X'@'host' | Bad credentials or host not allowed | Check GRANT and the user’s allowed hosts ('user'@'%' vs 'user'@'10.%'); MySQL matches user + host as a pair. On Azure, use the plain username — Flexible Server does not need the user@servername suffix (that was only for the retired Single Server). |
Unknown database 'X' | Wrong database name | Test with mysql -h host -u user -p X first. |
Authentication plugin caching_sha2_password requires secure connection | Full authentication needs TLS or supported RSA exchange | Configure TLS with the owner; do not downgrade the authentication plugin. |
Authentication plugin 'caching_sha2_password' cannot be loaded | Incompatible driver dependency or authentication configuration | contact us if you see it. |
| Empty results from a query you know matches rows | Case-sensitive table name on Linux | Check the exact name in INFORMATION_SCHEMA.TABLES and re-run discovery. |