---
title: "Migrating MySQL databases to MySQL semi-sync Managed Databases"
sidebar_label: "Migration to Managed Databases"
sidebar_position: 17
description: "How to migrate a MySQL database to MySQL semi-sync Managed Databases"
---

import Formbricks from '@theme/MDXComponents/Formbricks'

# Migration of MySQL databases to MySQL semi-sync Managed Databases

You can migrate data from your MySQL database to Managed Databases:

1. [Create an SQL dump](#create-sql-dump).
2. [Restore the database](#restore-database-from-sql-dump) from the SQL dump.

Only InnoDB is supported.

:::info

Before migration, ensure that the MySQL DBMS versions match. We do not guarantee successful migration between different versions. For more details, see the [official documentation](https://dev.mysql.com/doc/refman/8.0/en/faqs-migration.html).

:::

## Create an SQL dump \{#create-sql-dump}

Create an SQL database dump using the mysqldump utility:

```shell
mysqldump --user=<user_name> \
   --password=<password> \
   --host=<host> \
   --port=<port> \
   --set-gtid-purged=off \
   --no-tablespaces \
   --single-transaction <database_name> > dump.sql
```

Specify:

* `<user_name>` — database user name in the source;
* `<password>` — database user password;
* `<host>` — DNS or IP address of the node;
* `<port>` — port for connecting to the database;
* `--set-gtid-purged=off` — this flag indicates that replication based on global transaction identifiers (GTID) is not used;
* `--no-tablespaces` — disables the addition of service information to the dump, which requires additional permissions to access. This information does not affect user data and can be excluded from the dump;
* `--single-transaction` — creates an SQL dump within a single transaction;
* `<database_name>` — database name.

## Restore the database from an SQL dump \{#restore-database-from-sql-dump}

Restore the database from an SQL dump using the mysql utility:

```shell
mysql --user=<user_name> \
   --password=<password> \
   --host=<host> \
   --port=3306 <database_name> < dump.sql
```

Specify:

* `<user_name>` — username of the Managed Database;
* `<password>` — database user password;
* `<host>` — DNS or IP address of the node;
* `<database_name>` — database name.

If you are connecting with an SSL certificate, specify the additional `--ssl-ca` and `--ssl-mode:` parameters:

```shell
mysql --user=<user_name> \
   --password=<password> \
   --host=<host> \
   --port=3306 \
   --ssl-ca=~/.mysql/root.crt \
   --ssl-mode=required <database_name> < dump.sql
```

Specify:

* `<user_name>` — username of the Managed Database;
* `<password>` — database user password;
* `<host>` — DNS or IP address of the node;
* `<database_name>` — database name.

<Formbricks />
