# MySQL Destination Reference

MySQL is an open-source relational database management system.

This guide serves as a reference for version 1 of Stitch’s MySQL destination.

## Details and features

* [Stitch features](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#stitch-features)

* [Destination details](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#destination-details)

### Stitch features

High-level details about Stitch’s implementation of MySQL, such as supported connection methods, availability on Stitch plans, etc.

| **Release status<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | Released |
| --- | --- |
| **Stitch plan availability<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | All Stitch plans |
| **Stitch supported regions<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | <ul><li>North America (AWS us-east-1)</li><li>Europe (AWS eu-central-1)</li></ul><br><br>Operating regions determine the location of the resources Stitch uses to process your data. [Learn more](https://help.qlik.com/en-US/stitch/security/supported-data-pipeline-regions). |
| **Supported versions<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | 5.7.8 and later |
| **Connect API availability<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | **Supported<br>the Success iconSupported**<br><br>This version of the MySQL destination can be created and managed using Stitch’s Connect API. [Learn more](https://help.qlik.com/en-US/stitch/developers/stitch-connect/api#destination-form-properties). |
| **SSH connections<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | **Supported<br>the Success iconSupported**<br><br>Stitch supports using SSH tunnels to connect to MySQL destinations. |
| **SSL connections<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | **Supported<br>the Success iconSupported**<br><br>Stitch will attempt to use SSL to connect by default. No additional configuration is needed. |
| **VPN connections<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | **Unsupported<br>the Remove iconNot supported**<br><br>Virtual Private Network (VPN) connections may be implemented as part of a Premium plan. Contact [Stitch Sales](https://www.stitchdata.com/contact/) for more info. |
| **Static IP addresses<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | **Supported<br>the Success iconSupported**<br><br>This version of the MySQL destination has static IP addresses that can be whitelisted. |
| **Default loading behavior<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | **Upsert**<br><br>**Note**: Append-Only loading will be used if all conditions for Upsert are not met. [Learn more](https://help.qlik.com/en-US/stitch/replication/loading/understanding-loading-behavior). |
| **Nested structure support<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | **Supported**<br><br>the Success icon<br><br>Supported<br><br><br>Nested data structures will be maintained. [Learn more](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#transformations--json-structures). |

### Destination details

Details about the destination, including object names, table and column limits, reserved keywords, etc.

**Note**: Exceeding the limits noted below will result in loading errors or rejected data.

| **Maximum record size<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | 20MB |
| --- | --- |
| **Table name length<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | 60 characters |
| **Column name length<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | 64 characters |
| **Maximum columns per table<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | 1017 |
| **Maximum table size<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | Depends on the InnoDB page size |
| **Maximum tables per database<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | None |
| **Case sensitivity<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | Insensitive |
| **Reserved keywords<br><br><br>[the Help icon](https://help.qlik.com/en-US/stitch/destinations/mysql/reference)** | Refer to the [Reserved keywords documentation](https://help.qlik.com/en-US/stitch/). |

## Replication

* [Replication process overview](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#replication-process-overview)

* [Loading behavior](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#loading-behavior)

* [Primary Keys](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#replication--primary-keys)

* [Incompatible sources](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#replication--incompatible-sources)

### Replication process overview

A Stitch replication job consists of three stages:

* [Step 1: Data extraction](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#replication--data-extraction)

* [Step 2: Preparation](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#replication--stitch-internal-pipeline)

* [Step 3: Loading](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#replication--loading)

#### Step 1: Data extraction

Stitch requests and extracts data from a data source. Refer to the [System overview guide](https://help.qlik.com/en-US/stitch/getting-started/basic-concepts-system-overview#system-architecture--extraction) for a more detailed explanation of the Extraction phase.

#### Step 2: Preparation

During this phase, the extracted data is buffered in Stitch’s durable, highly available internal data pipeline and readied for loading. Refer to the [System overview guide](https://help.qlik.com/en-US/stitch/getting-started/basic-concepts-system-overview#system-architecture--preparing) for a more detailed explanation of the Preparation phase.

#### Step 3: Loading

Stitch loads the data into MySQL.

**Note**: With this destination, a new database is created for each integration. The name of the databases created are based on the integration names. To avoid any issues, make sure that you don’t create any databases with a name that matches an existing integration.

### Loading behavior

By default, Stitch will use **Upsert loading** when loading data into MySQL.

If the conditions for Upsert loading aren’t met, data will be loaded using Append-Only loading.

Refer to the [Understanding loading behavior guide](https://help.qlik.com/en-US/stitch/replication/loading/understanding-loading-behavior) for more info and examples.

### Primary Keys

Primary Keys in MySQL v1 destinations cannot exceed 768 characters in string fields.

### Incompatible sources

No compatibility issues have been discovered between MySQL and Stitch's integration offerings.

See all [destination and integration incompatibilities.](https://help.qlik.com/en-US/stitch/destinations/destination-integration-compatibility)

## Transformations

* [System tables and columns](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#transformations--system-tables-columns)

* [Data typing](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#transformations--data-typing)

* [JSON structures](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#transformations--json-structures)

* [Column names](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#transformations--column-naming)

* [Table names](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#transformations--table-naming)

* [Timezones](https://help.qlik.com/en-US/stitch/destinations/mysql/reference#transformations--timezones)

### System tables and columns

Stitch will create the following tables in each integration’s dataset:

* [_sdc_rejected](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table)

Additionally, Stitch will insert [system columns](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns) (prepended with `_sdc`) into each table.

### Data typing

Stitch converts data types only where needed to ensure the data is accepted by MySQL. In the table below are the data types Stitch supports for MySQL destinations, and the Stitch types they map to.

* **Stitch type:** The Stitch data type the source type was mapped to. During the Extraction and Preparing phases, Stitch identifies the data type in the source and then maps it to a common Stitch data type.
* **Destination type:** The destination-compatible data type the Stitch type maps to. This is the data type Stitch will use to store data in MySQL.
* **Notes:** Details about the data type and/or its allowed values in the destination, if available. If a range is available, values that exceed the noted range will be [rejected by MySQL](https://help.qlik.com/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table).

| **Stitch type** | **Destination type** | **Notes** |
| --- | --- | --- |
| BIGINT | [BIGINT](https://dev.mysql.com/doc/refman/8.0/en/integer-types.html) | <ul> <li> <p><strong>Range </strong></p><div><strong><button>the Warning 2 icon</button><div>Values that exceed this range will be rejected by the destination and logged in the &lt;strong&gt;_sdc_rejected&lt;/strong&gt; table. &lt;a href='/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table'&gt;Learn more&lt;/a&gt;.</div></strong></div><strong>:</strong>-9223372036854775808 to 9223372036854775807<p></p> </li> </ul> |
| BOOLEAN | [TINYINT(1)](https://dev.mysql.com/doc/refman/8.0/en/integer-types.html) |  |
| DATE | [DATETIME](https://dev.mysql.com/doc/refman/8.0/en/datetime.html) | <ul> <li> <p><strong>Description</strong>: Stored in UTC with fractional seconds.</p> </li> <li> <p><strong>Range </strong></p><div><strong><button>the Warning 2 icon</button><div>Values that exceed this range will be rejected by the destination and logged in the &lt;strong&gt;_sdc_rejected&lt;/strong&gt; table. &lt;a href='/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table'&gt;Learn more&lt;/a&gt;.</div></strong></div><strong>:</strong>1000-01-01 to 9999-12-31<p></p> </li> </ul> |
| DOUBLE | [FLOAT(53)](https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html) |  |
| FLOAT | [FLOAT(53)](https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html) |  |
| INTEGER | [INT](https://dev.mysql.com/doc/refman/8.0/en/integer-types.html) | <ul> <li> <p><strong>Range </strong></p><div><strong><button>the Warning 2 icon</button><div>Values that exceed this range will be rejected by the destination and logged in the &lt;strong&gt;_sdc_rejected&lt;/strong&gt; table. &lt;a href='/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table'&gt;Learn more&lt;/a&gt;.</div></strong></div><strong>:</strong>-2147483648 to 2147483647<p></p> </li> </ul> |
| NUMBER | [DECIMAL](https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html) | <ul> <li> <p><strong>Range </strong></p><div><strong><button>the Warning 2 icon</button><div>Values that exceed this range will be rejected by the destination and logged in the &lt;strong&gt;_sdc_rejected&lt;/strong&gt; table. &lt;a href='/en-US/stitch/replication/loading/system-tables-columns/rejected-records-system-table'&gt;Learn more&lt;/a&gt;.</div></strong></div><strong>:</strong>-99999999999999999999999999999999.999999M to 99999999999999999999999999999999.999999M<p></p> </li> </ul> |
| STRING | [LONGTEXT](https://dev.mysql.com/doc/refman/8.0/en/blob.html) | <ul> <li> <p><strong>Description</strong>: <code>LONGTEXT</code> is used for all strings except Primary Keys. If a string is loaded into a Primary Key field, it uses the <code>VARCHAR</code> type.</p> </li> </ul> |

### JSON structures

MySQL supports nested records within tables, whether it’s a single record or repeated values. This means that when nested data structures are loaded into MySQL, they will be maintained.

### Column names

Column names in MySQL:

Stitch will perform the following transformations to ensure column names [adhere to the rules imposed by MySQL](https://help.qlik.com/en-US/stitch/destinations/mysql/reference):

| **Transformation** | **Source column** | **Destination column** |
| --- | --- | --- |
| Trim leading and trailing spaces | `  customerid  ` | `customerid` |
| Replace characters which are not a-z, A-Z, 0-9, \_ or $ with an underscore | `customer-id` | `customer_id` |
| Convert to lowercase | `CustomerID` | `customerid` |

### Table names

Table and schema names in MySQL:

Stitch will perform the following transformations to ensure table and schema names [adhere to the rules imposed by MySQL](https://help.qlik.com/en-US/stitch/destinations/mysql/reference):

| **Transformation** | **Source name** | **Destination name** |
| --- | --- | --- |
| Trim leading and trailing spaces | `  customerid  ` | `customerid` |
| Replace characters which are not a-z, A-Z, 0-9, \_ or $ with an underscore | `customer-id` | `customer_id` |
| Convert to lowercase | `CustomerID` | `customerid` |

### Timezones

MySQL will store the value as `TIMESTAMP WITHOUT TIMEZONE`. In MySQL, this data is stored without timezone information and expressed as UTC with fractional seconds.

## Compare destinations

**Not sure if MySQL is the destination for you?** Check out the [Choosing a Stitch Destination](https://help.qlik.com/en-US/stitch/destinations/choosing-a-stitch-destination) guide to compare each of Stitch’s destination offerings.