This document describes how to migrate data through console and command line tool.
There are two modes for migrating data through the console: physical backup and logical backup. For more information, please see:
Note:
- The data files exported through mysqldump must be compatible with the SQL specification of your purchased TencentDB for MySQL version. 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".- Make sure that the same source and target database version, source and target database character set, and mysqldump tool version are used. You can specify the character set using the parameter
--default-character-set
.
shell > mysqldump [options] db_name [tbl_name ...] > bak_pathname
Here, options
is the export option, db_name
is the database name, tbl_name
is the table name, and bak_pathname
is the export path.shell > mysql -h hostname -P port -u username -p < bak_pathname
Here, 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.show databases;
command, and you can see that the backup database has been imported into the target database.This document takes Linux CVM instance as an example. For more information on how to access a database on a CVM instance, see Accessing a MySQL Database.
db_blog
database in TencentDB as an example:show databases;
command, and you can see that the backup database has been imported into the target database.For more information on character set encoding, please see "Notes on Character Set" in Use Limits.
Was this page helpful?