Alibaba Cloud is now ranking No. 3 infrastructure as a service provider in the world, trailing only AWS and Microsoft Azure. In the Asia-Pacific region, Alibaba Cloud boasts a strong lead on the market of cloud providers. More and more businesses are moving to Alibaba Cloud because of its cost-effectiveness, top performance, and high availability. In this tutorial, we provide a detailed overview of two ways to migrate an open source MySQL database to ApsaraDB RDS Alibaba Cloud database service.
Essentially, the process of moving a database to an ApsaraDB RDS is pretty much similar to moving a database from one server to another. Let’s look at two simple ways to perform it.
Back up and restore a database on ApsaraDB RDS with mysqldump Back up and restore a database on ApsaraDB RDS with dbForge Studio for MySQL
The mysqldump client utility is used primarily for performing logical backups. With its help, you can dump one or more MySQL databases and move them to another server. mysqldump supports a bunch of useful database management operations, however, in this article, we will focus exclusively on its backup capabilities.
Prerequisites
1. This tutorial assumes that you have already created an Alibaba Cloud account.
2. This tutorial assumes that you have already created ApsaraDB RDS for MySQL instance, configured IP address whitelist, and obtained a public endpoint.
For more information, refer to Sign up with Alibaba Cloud.
Step 2. Create a MySQL backup.
To create a MySQL database backup, run the command:
mysqldump --user root --password [db_name] > [db_name].sql
For example, let’s dump the nation database that is stored at our local MySQL Server. The command for this will look like as follows:
mysqldump -h 127.0.0.1 -u root -p --opt --default-character-set=utf8 --hex-blob nation --skip-triggers --skip-lock-tables > D:\Backup\nation.sql
Step 3. Connect to ApsaraDB RDS instance and create an empty database.
Run the MySQL Command Line Tool, connect to the ApsaraDB RDS instance, and create an empty database as shown in the picture below.
Step 4. Using mysqldump, restore the database from the backup you have created earlier. The command for restoring a database is given below. After mysqldump asks for a password, provide it.
mysql -u [user] -p [database_name] < [filename].sql
In our guide, we run the following command to restore the MySQL nation database on ApsaraDB RDS.
mysql -h rm-4xo7kd5l1k993t1tnoo.mysql.germany.rds.aliyuncs.com -P 3306 -u root -p nation < D:\Backup\nation.sql
The operation has been successful, and the database has been restored. We can check this by using the SHOW TABLES; command.
As you can see, the database is no longer empty. Let’s now look at the ApsaraDB RDS console. The nation database has appeared on the Databases tab.
For more information on how to perform DB backups, please refer to Different Ways to Back up MySQL Databases and Tables.
dbForge Studio for MySQL is an all-in-one GUI solution for developing, managing, and administering MySQL and MariaDB databases. It provides a simple visual way to back up and restore a database on Alibaba Cloud just in a few clicks.
In this tutorial, we will demonstrate how to migrate the world database from localhost to Alibaba Cloud ApsaraDB RDS.
Prerequisites
1. The tutorial assumes that you have created an Alibaba Cloud account.
2. The tutorial assumes that you have already created ApsaraDB RDS for MySQL instance, configured IP address whitelist, and obtained a public endpoint.
4. To be able to use the backup and restore functionality of dbForge Studio for MySQL, download and install the tool.
Workflow
Step 1. Create a database backup.
To create a DB backup with dbForge Studio for MySQL, right-click the required database in Database Explorer and select Backup and Restore > Backup Database.
In the Database Backup Wizard that opens, provide a path to the directory to save the backup file and click Next.
On the Backup content tab, select database objects to back up and click Next.
On the Options tab, specify the backup options and click Next.
On the Errors handling tab, configure errors processing behavior and logging options. Click Backup to perform the backup operation.
Step 2. Connect to the ApsaraDB RDS instance.
To connect to the ApsaraDB RDS instance, on the Database menu, click New Connection. In the Database Connection Properties dialog that opens, configure the connection properties and click Connect.
Step 3. Create an empty database on Alibaba Cloud ApsaraDB RDS.
To create a database in dbForge Studio for MySQL, on the Database menu, click New Database. On the Create database page that opens, provide a name for a new database, specify its character set and collation, and click Apply changes.
Step 4. Restore a database on Alibaba Cloud ApsaraDB RDS.
To restore a database with dbForge Studio for MySQL, right-click the empty database in Database Explorer and select Backup and Restore > Restore Database.
In the Database Restore wizard that opens, select the file to restore the database from and click Restore.
Let’s now check the ApsaraDB RDS console. As you can see, the world database has appeared in the list of databases.
Let’s check the Studio too. The world database is now listed in Database Explorer, and the database data has remained intact. Our efforts have been successful.
Unlike mysqldump, dbForge Studio for MySQL lets you migrate a database from MySQL or MariaDB Server to Alibaba Cloud with little to no effort. You don’t need to memorize complex commands and enter them manually from the command line. Instead, the Studio delivers a visual, intuitive way to back up and restore a database in a couple of clicks. More than that, you don’t need to back up your entire database—just select database objects to be included in your backup file. And that's not to mention the fact that the Studio allows you to schedule backup and restore operations as well as other routine tasks from the command line.
After all, a picture is worth a thousand words, so download dbForge Studio for MySQL and get a FREE 30-day fully-functional trial to be able to evaluate all the advanced features it delivers.
AlenaS - May 13, 2021
Alibaba Clouder - August 2, 2019
Alibaba Clouder - May 27, 2019
Alibaba Clouder - May 28, 2019
Alibaba Container Service - April 17, 2024
Alibaba Clouder - May 27, 2019
Migrate your legacy Oracle databases to Alibaba Cloud to save on long-term costs and take advantage of improved scalability, reliability, robust security, high performance, and cloud-native features.
Learn MoreMigrating to fully managed cloud databases brings a host of benefits including scalability, reliability, and cost efficiency.
Learn MoreAn easy transformation for heterogeneous database.
Learn MoreAlibaba Cloud PolarDB for MySQL is a cloud-native relational database service 100% compatible with MySQL.
Learn More