All connectors

Database

MySQL

MySQL Connector

Index the tables of a MySQL database: one document per table, rows rendered as readable text rather than a schema dump.

Prerequisites

  • A MySQL database you can read, version 5.7 or later
  • A user with `SELECT` on the tables to index
  • The database name, and its host and port if it is not local

Data ingested

When you connect MySQL, the following content becomes searchable. Every answer that uses it cites it.

ContentWhat is kept
TablesEvery table and view of the selected database, listed from `information_schema`
RowsUp to 500 rows per table, each row rendered as `column = value` pairs
DatesA `DATE` column stays a date: no invented time is appended

Setup

Configuration happens in the dashboard, under Integrations. No API call is needed for a normal setup.

1

Create a read-only user

`CREATE USER 'qm_reader'@'%' IDENTIFIED BY '...'; GRANT SELECT ON mydb.* TO 'qm_reader'@'%';` Read-only is enough: the session is set to `READ ONLY` and the connector never writes.

2

Enter the connection

Integrations → Add source → MySQL: host, port (3306 by default), database and user. Or paste a `mysql://` URL in the **URL** field.

3

Set the secret

The user password, in the **Secret** field.

4

Connect and sync

**Test** lists the tables without indexing; **Sync** reads the rows and indexes them.

Where the credential goes
The password goes in the **Secret** field. It is stored server-side and never returned by the API. A connection URL of the form `mysql://user:password@host:port/database` can be given instead, and it then carries the credentials itself.

Configuration options

FieldDescriptionRequired
URL or DSNFull `mysql://user:password@host:port/database`. Takes precedence over the separate fieldsNo
HostDatabase host. Defaults to `127.0.0.1`No
PortDatabase port. Defaults to `3306`No
DatabaseName of the database to indexYes
UserUser used to connectYes
SecretPassword of that userNo
SchemaRestrict indexing to one schema. Empty means the database itselfNo

Best practices

  • •Only the selected database is read: `information_schema` is filtered on it, so a server hosting several applications does not leak the others into the corpus.
  • •A `BLOB` or binary column is rendered as its text form and carries no knowledge: exclude those tables rather than paying for their embeddings.
  • •MariaDB speaks the same protocol and is declared as its own type: pick **MariaDB** in the form so the source is labelled correctly, even though the same code serves both.

Troubleshooting

`Access denied for user`

The password is in the **Secret** field, and the user must be allowed from the host the server sees, not only from `localhost`.

`config.database est requis`

The **Database** field is empty. MySQL has no default database to fall back on.

A table is missing from the result

The user lacks `SELECT` on it, or it belongs to another database on the same server.

Connection refused on a remote server

The server listens on `127.0.0.1` only, or the firewall blocks the port. Check `bind-address` on the server side.

Next steps

Once the source is connected and indexed, ask a question from the chat and check that the answer cites this source. A source that never appears in a citation is usually a source with nothing indexed: see Troubleshooting above.