TDSQL-C for MySQL supports data migration through a command line tool.
mysqldump
in the following way:
Note:The data files exported by using
mysqldump
must be compatible with the SQL specification of your purchased TDSQL-C for MySQL database. You can log in to the database and get the MySQL version information by running theselect 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
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.
For more information on how to export data with mysqldump, see mysqldump — A Database Backup Program.
2. 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
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.
Note: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 using the parameter
.
For more information on how to access a database on a CVM instance, see Connecting to Cluster via the Console.
db_blog
database 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, see the character set description in Use Limits.
Was this page helpful?