TDSQL-C (MySQL Edition) supports data migration through a command line tool.
Generate the SQL file to be imported with the MySQL command line tool "mysqldump" in the following way:
The data files exported by using mysqldump must be compatible with the SQL specification of your purchased TDSQL-C (MySQL Edition) database. You can log in to the database and get the MySQL version information by running the
select version();command. The name of the generated SQL file can contain letters, digits, and underscores but not "test".
shell > mysqldump [options] db_name [tbl_name ...] > bak_pathname
options is the export option,
db_name is the database name,
tbl_name is the table name, and
bak_pathname is the export path.
For more information on how to export data with mysqldump, please see MySQL's official documentation.
A database can be restored with the MySQL command line tool by running the following command:
shell > mysql -h hostname -P port -u username -p < bak_pathname
hostname is the target server for data restoration,
port is the port of target server,
username is the username of the database on the target server, and
bak_pathname is the full path to the backup file.
Make sure that the same source and target database versions, mysqldump tool versions, and source and target database character sets are used. You can specify the character set by using the parameter
For more information on how to access a database on a CVM instance, please see Accessing TDSQL-C Cluster.
db_blogdatabase in TencentDB for example, log in to the CVM instance and generate the SQL file to be imported with the MySQL command line tool "mysqldump".
For more information, please see the character set description in Use Limits.