Skip to content

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 SELECT on 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

FieldWhere to get it
HostYour cloud console — AWS RDS: instance endpoint; GCP Cloud SQL: public/private IP; Azure Database for MySQL: server hostname (*.mysql.database.azure.com)
PortDefault 3306; visible under the connection info panel in your cloud console
DatabaseThe database name — list with SHOW DATABASES; in the MySQL CLI
UsernameThe user you created above
PasswordThe password you set in CREATE USER

What to enter

Host: your-host.example.com
Port: 3306
Database: your_db
Username: datarelix_reader
Password: ••••••••

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_db

Scope 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 LIMIT get one added automatically.

Troubleshooting

SymptomLikely causeFix
Access denied for user 'X'@'host'Bad credentials or host not allowedCheck 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 nameTest with mysql -h host -u user -p X first.
Authentication plugin caching_sha2_password requires secure connectionFull authentication needs TLS or supported RSA exchangeConfigure TLS with the owner; do not downgrade the authentication plugin.
Authentication plugin 'caching_sha2_password' cannot be loadedIncompatible driver dependency or authentication configurationcontact us if you see it.
Empty results from a query you know matches rowsCase-sensitive table name on LinuxCheck the exact name in INFORMATION_SCHEMA.TABLES and re-run discovery.