Export data to SQL, CSV, or Excel

更新时间:
复制 MD 格式

This topic explains how to use DMS to export data from an RDS database to an SQL, CSV, or Excel file.

Check source data

In DMS, verify that Chinese characters display correctly. In the SQL Console, run the SELECT * FROM st; statement. The query returns two records: the first is (id=1, name=gert, age=23, column_name=Chinese export test), and the second is (id=2, name=gert, age=33, column_name=This page cannot be displayed).

View table character set

To view the CREATE TABLE statement for a table, run the following command:

show create table <table_name>;
mysql>show create table st
+------------------------+-------------------------------------------------------------------+
| Table                  | Create Table                                                      |
+------------------------+-------------------------------------------------------------------+
| st                     | CREATE TABLE `st` (
  `id` int(11) DEFAULT NULL,
  `name` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  `column_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
+------------------------+-------------------------------------------------------------------+

Create an export task

  1. In DMS, navigate to Database Development > Data Export > Database Export.

  2. Click Database Export.

  3. Select the tables that you want to export, configure settings such as the file format and character set, and then click Submit. On the Database Export page, configure the following parameters. In the Database Name drop-down list, search for and select the target database. Select an option for Exported Tables (Partial Tables or All Tables), Export Content (Data, Structure, or Data & Structure), and File Format (SQL, CSV, or EXCEL). If needed, select the Exported Structure Type, such as stored procedure, function, trigger, view, or event. In the Tables and Filter Conditions panel on the right, select the tables to export and set filter conditions. After you complete the settings, click Submit.

FAQ

When I use an SQL file exported from DMS to restore data to a self-managed instance, why are only the table names restored but not the data?

When exporting data from DMS, you must set Export content to Data & Structure. Before restoring data to a self-managed instance, you must first manually create the required database on the instance and then import the SQL script.