MySQL
Connect a MySQL database so Qubit can read its tables. You can copy the data into Qubit on a schedule (Sync Mode) or query the database live (Direct Mode).
Before you start
- Create a dedicated read-only user for Qubit and grant it
SELECTon the database you want to use. - Make sure MySQL accepts remote connections from Qubit's servers, and that the user is allowed to connect from outside the server. If the database is only reachable inside a private network, you can connect through an SSH bastion host.
Connect MySQL
- Open Data Catalog from the sidebar, click Add Data, then choose Connect a database.
- On the New Data Source page, click MySQL. It is under Databases.
- Enter a Connection Name.
- Fill in the connection details:
- Host: the server's hostname or IP address.
- Port: defaults to
3306. - Database: the database to read.
- Username and Password: the read-only user you created.
- Under Connection Mode, choose Sync Mode to copy the data into Qubit, or Direct Mode to query the database live.
- To reach the database through a bastion host, turn on Connect via SSH tunnel and enter the SSH host, SSH port, SSH username, SSH private key (PEM), and the key passphrase if it has one. The tunnel always uses Direct Mode.
- For Sync Mode, choose a Sync Schedule. The default is Daily.
- Click Create.
Qubit tests the connection before saving it, then takes you to the Data Catalog. In Sync Mode, the first sync starts right away. You cannot change the connection mode or the SSH tunnel after the connection is created.
If the test fails
The form shows the error message:
- "Access denied": the username or password is wrong, or the user is not allowed to connect from outside the server.
- "Database does not exist": check the database name.
SHOW DATABASES;lists the databases the user can see. - "Could not reach" or "timed out": check the host and port, and that MySQL accepts remote connections.