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

import Formbricks from '@theme/MDXComponents/Formbricks'

# Migration of MySQL databases to MySQL 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 an SQL dump.

Only InnoDB is supported.

:::info

Before migrating, ensure that the MySQL DBMS versions match. We do not guarantee migration between different versions. Learn more in 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 dump of the database using the mysqldump utility:

```bash
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>` — the source database user name;
* `<password>` — the database user password;
* `<host>` — the DNS or IP address of the node;
* `<port>` — the port for connecting to the database;
* `--set-gtid-purged=off` — the option indicates that GTID-based replication is not used;
* `--no-tablespaces` — prevents adding service information to the dump that 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>` — the name of the database.

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

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

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

Specify:

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

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

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

Specify:

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

<Formbricks />
