# Add a MySQL connector

## Connector features

You can use the Toucan MySQL connector to connect to a mySQL cluster with a basic authentication and/or a chain certificate and access `tables` with a SQL query or by [using our no-code form ](https://docs-v3.toucantoco.com/data-management-in-datahub/datasources-in-toucan/managing-connectors/create-a-dataset-from-a-connector/code-mode-and-single-mode).

With this connection, you can fetch data from your mySQL to fill your charts and dashboards.

{% hint style="info" %}
**Changelog**

**July 25**

* This data connector is supported for connection and [NativeSQL](https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/youprep-tm-native-sql) by our [new Data Execution system](https://www.toucantoco.com/en/blog/multi-tenant-architecture)
  {% endhint %}

## Configuring a MySQL connection

Follow the steps described in [..](https://docs-v3.toucantoco.com/data-management-in-datahub/datasources-in-toucan/managing-connectors/setting-up-a-connector "mention"), choose `MySQL` and fill out the form with the following info:

<table><thead><tr><th>Field</th><th width="137.91796875">Format / Type</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>Name (mandatory)</td><td>String</td><td>Use it to identify your connection</td><td><em>MySQLConnection</em></td></tr><tr><td>Host (mandatory)</td><td>String</td><td>The domain name or IP address of your database server</td><td><em>"db.example.com"</em> or <em>"192.168.1.100"</em></td></tr><tr><td>Port (mandatory)</td><td>String</td><td>The listening port of your database server</td><td><em>3306</em></td></tr><tr><td>User (mandatory)</td><td>String</td><td>Your login user</td><td><em>myuser</em></td></tr><tr><td>Password (mandatory)</td><td>String</td><td>Your login password (this value will be stored as a secret)</td><td><em>secretpassword123</em></td></tr><tr><td>Charset (optional)</td><td>String</td><td>Character encoding for the connection</td><td><em>"utf8mb4"</em> (default value)</td></tr><tr><td>Charset Collation (optional)</td><td>String</td><td>The charset's collation for server connections</td><td><em>"utf8mb4_unicode_ci"</em></td></tr><tr><td>Connect Timeout (optional)</td><td>Integer</td><td>Connection timeout in seconds</td><td><em>30</em></td></tr><tr><td>SSL Mode (optional)</td><td>Enum</td><td><p>SSL Mode for MySQL server connection. If this option is disabled, the SSL Mode defaults to PREFERRED (use TLS if available)<br>Options: <code>VERIFY_IDENTITY</code>, <code>VERIFY_CA</code>, <code>REQUIRED</code><br></p><ul><li><code>REQUIRED</code>: Force TLS (without any identity verification and a CA cert),<br>Required fields: none</li><li><code>VERIFY_CA</code>: Force TLS and check server certificat against <code>SSL_CA</code> certificate<br>Required fields: <code>SSL_CA</code></li><li><code>VERIFY_IDENTITY</code>: Force TLS and check server certificate against <code>SSL_CA</code>, check hostname in the certificate (common name/dns names)<br>Required fields: <code>SSL_CA</code></li></ul></td><td><em>VERIFY_CA</em></td></tr><tr><td>SSL CA</td><td>String</td><td>CA certificate in PEM format, used for SSL Mode see SSL Mode for more information.</td><td><em>-----BEGIN CERTIFICATE-----</em><br><em>...</em><br><em>-----END CERTIFICATE-----</em></td></tr><tr><td>SSL Cert</td><td>String</td><td>X509 certificate in PEM format used for client authentication (mTLS)</td><td><em>-----BEGIN CERTIFICATE-----</em><br><em>...</em><br><em>-----END CERTIFICATE-----</em></td></tr><tr><td>SSL Key</td><td>String</td><td>Private key in PEM format used for client authentication (mTLS).</td><td><em>-----BEGIN PRIVATE KEY-----</em><br><em>...</em><br><em>-----END PRIVATE KEY-----</em></td></tr><tr><td>Retry Policy (optional)</td><td>Boolean</td><td><p><em>Boolean</em> allows to configure a retry policy if the connection is flaky.</p><ul><li>max attempts: maximum number of retries before giving up</li><li>max_delay: in seconds, above the connection is dropped</li><li>wait_time: time in seconds between each retry</li></ul></td><td></td></tr><tr><td>Slow Queries' Cache Expiration Time (optional)</td><td>Integer</td><td>Slow queries' cache expiration time in seconds</td><td></td></tr></tbody></table>

* Click on the `TEST CONNECTION` button then `SAVE` the connection

{% hint style="success" %}
After successfully configuring the connector, you will be able to find it in the Connector section of the DataHub "Datasource" tab
{% endhint %}

## Create a dataset from a MySQL connection

{% hint style="info" %}
This data connector is supported in

* [code/SQL mode](https://docs-v3.toucantoco.com/data-management-in-datahub/datasources-in-toucan/managing-connectors/create-a-dataset-from-a-connector/code-mode-and-single-mode) for our current Data Execution system
* both modes with our new Data Execution System
  {% endhint %}

To create a dataset from MySQL, click on the "create from icon", you will then be able to:

* Select the `Database`
* Select the `Schema`
* Select `Table` or `Views`
* Only keep columns you need

{% hint style="info" %}
For more info, see the dedicated section [creating-datasets](https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/managing-datasets/creating-datasets "mention")
{% endhint %}

{% hint style="success" %}
After selecting data from your connector you will be able to create a dataset thanks to [YouPrep](https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm) using the selection as "source step".
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-v3.toucantoco.com/data-management-in-datahub/datasources-in-toucan/managing-connectors/setting-up-a-connector/database-and-data-warehouse-connectors/setting-up-a-mysql-connector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
