MySQL (opens new window) is a very powerful database. When you run it on-premises, you are responsible for keeping it up and running and for securing it and making it as performant as possible. When you run your MySQL database in Azure Database for MySQL (opens new window), Azure manages it and ensures that it is highly available, performant and secure, so that you can focus on using the database and building valuable applications with it. To get your existing MySQL database into Azure, you need to migrate it. You can use several tools and techniques to do that
(opens new window), depending on your MySQL version and where you are running it.
In this post, we'll migrate a MySQL database that is running in a Virtual Machine
(opens new window), to a managed MySQL database that runs in an Azure Database for MySQL
(opens new window) server.
Prerequisites
- If you want to follow along, you'll need the following:
- An Azure subscription (If you don't have an Azure subscription, create a free account
- (opens new window) before you begin)
An existing MySQL database that is connected to Azure (with a hybrid connection, like Azure ExpressRoute
(opens new window), or running in Azure in a Virtual Machine). If you don't have an existing MySQL database, you can create one by installing a MySQL server (opens new window) and running the SQL script in this GitHub repository
(opens new window) in a schema on the server
MySQL Workbench - (opens new window) that can access the existing MySQL database
Azure Database Migration for MySQL
I have a MySQL database that is running in a Virtual Machine in Azure. You might have one that is running on-premises or in another cloud. When that's the case, you need to create a connection between the environment where your MySQL is running and Azure, which is beyond the scope of this article.
Let's migrate the MySQL database from my VM to Azure Database for MySQL. I'll start by creating an Azure Database for MySQL with the Azure portal.
- Go to the Azure portal
- (opens new window)
Click the Create a resource button (the plus-sign in the top left corner)
Search for mysql, select the "Azure Database for MySQL" result and click Create - This brings you to the create MySQL server blade
- Select a Resource Group
- Fill in a Name for the server
- Select a Location
- Pick a Version. For this example, we'll use MySQL version 5.7. You need to make sure that the target server (in Azure), is the same version as the existing MySQL server
- Select the Compute + Storage tier
- Fill in an Admin username for the server
- Tye a Password and Confirm the password
- Click Review + create and Create after that. This creates the Azure Database for MySQL server
Regards,
Jennifer