tencent cloud

Feedback

MySQL Offline Data Migration

Last updated: 2018-08-24 17:12:14
The documentation is not available now.

    Migrating Data via Console

    1. Log in to the Cloud Database console to download backup files. (For more information, please see Downloading Backup Files)
    2. A database can be recovered with MySQL command line tool, as shown below:
      shell > mysql -h hostname -P port -u username -p < bak_pathname
      
      The "hostname" is the destination server to be recovered. The "port" is the port of destination server. The "username" is the user name for the database on the destination server. The "bak_pathname" is the full path for backup files.
    3. Log in to the MySQL database to recover the database table with shell > source bak_pathname.
      The "bak_pathname" is the full path for backup files.

    Migrate data on Windows

    1. Take the database "db_blog" as an example. Log in to the Cloud Database console and locate the instance of which you need to export data. Click Management -> Backup Management to enter the backup management page. Find the backup files to be downloaded and click Download -> Partial Download.

    2. Select the database to be exported and click Next.
    3. Click Download in Download Locally to download backup files to the local computer.
    4. Record the full path.
      The full path for this example is as follows: F:\download\cdb147691_backup_20170717050142
    5. Enter the command prompt to recover the database with MySQL command line tool.
    6. Log in to the MySQL database, and you can find that the backup database has already been recovered to the server.

    Migrate database table on Windows

    1. Take the database table "t_blog" under "db_blog" as an example. Download backup files from the Cloud Database console.
    2. Download backup files from the Cloud Database console and record the full path.
      The full path for this example is F:\download\cdb147691_backup_20170718050146.
    3. Enter the command prompt to recover the database with MySQL command line tool.
    4. Log in to the MySQL database, and you can find that the backup database table has already been recovered to the server.

    Migrating Data with Command Line Tool

    1. Generate the SQL files to be imported using MySQL command line tool mysqldump, as shown below:

      Note:
      The data files exported by mysqldump must be compatible with the SQL standard of the purchased cloud database's MySQL version. You can log in to the cloud database via select version (); to obtain corresponding MySQL version information. The generated SQL file name can contain English letters/numbers/underscores, but cannot contain "test" characters.

      shell > mysqldump [options] db_name [tbl_name ...] > bak_pathname
      

      The "options" is the export option. The "db_name" is the database name. The "tbl_name" is the table name, and the "bak_pathname" is the export path.
      For more information on how to export data with mysqldump, please see official MySQL manual.

    2. A database can be recovered with MySQL command line tool, as shown below:

      shell > mysql -h hostname -P port -u username -p < bak_pathname
      

      The "hostname" is the destination server to be recovered. The "port" is the port of destination server. The "username" is the user name for the database on the destination server. The "bak_pathname" is the full path for backup files.

    Migrate data on CVM Linux system

    For more information on accessing the database on CVMs, please see Assess MySQL Database.

    1. Take the db_blog database on Cloud Database as an example. Log in to the CVM and generate the SQL files to be imported using MySQL command line tool mysqldump, as shown below:
    2. Recover the data with MySQL command line tool. In this example, the data is recovered to a CVM. You can find that the backup database has already been recovered to the corresponding database on the destination server.

    Character Set Encoding Issues of Imported Data Files

    1. If the imported data files do not specify a character set encoding, the one set by the cloud database will be executed.
    2. If the imported data files have specified a character set encoding, the specified one will be executed.
    3. If the character set encoding of imported data files is different from those of the cloud database, it will display unreadable codes.

    For more information on character set encoding, please see Character Set in Use limits

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support