Overview
TencentDB for MySQL supports importing SQL files via the console, allowing you to execute SQL statements in the selected database. You can also use this feature to create databases/tables and change table structures to initialize or modify the instance.
Note:
The SQL file import feature (which corresponds to the data import feature in the console) is undergoing upgrade maintenance. You can perform data import using the client. The completion time for this maintenance will be announced in the console.
Only two-node and three-node TencentDB for MySQL instances support importing SQL files.
Must-Knows
The SQL file import feature supports two methods: direct file upload or downloading from Cloud Object Storage (COS). To import SQL files to your TencentDB for MySQL using the COS download method, you need to first upload the file to COS to obtain the corresponding source file link. For detailed operations, see Appendix 1: Uploading Files to COS and Obtaining COS Source File Links. Directions
1. Log in to the TencentDB for MySQL console. In the instance list, click an Instance ID or Manage in the Operation column to access the instance management page. 2. On the instance management page, select Database Management > Database List and click Import Data.
3. Select one of the following methods to proceed as needed.
Method 1: Uploading a File Directly
Method 2: Downloading the File from COS
Note:
To prevent the database from becoming unavailable due to corrupted system tables, do not import data from system tables such as the mysql.user table.
Only incremental data import is supported. If there is obsolete data in the database, clear the data first before performing the import operation.
Importing zip compressed files is supported with limitations: Encrypted compressed files or compressed files exceeding 5 GB after decompression are not supported currently; only SQL files smaller than 5 GB after decompression are supported.
A single regular file cannot exceed 12 GB. If it is compressed, ensure that the decompressed file does not exceed 5 GB. File names can contain letters, digits, and underscores.
Uploaded files are valid for 14 days and will be automatically deleted upon expiration.
In the pop-up window, click Add File to import the file. After the upload is completed, click Next.
In the pop-up window, paste the COS source file link and click Next.
4. On the target database selection page, choose the target database (or proceed without specifying a database), and then click Next.
5. On the confirmation page, confirm that the imported data is correct, enter the account password, and click Import.
Note:
The import cannot be rolled back. Confirm the import information before proceeding.
6. After the task is executed, you can check whether the file is successfully imported by querying the import records. You can click Import Records on the right side of the database list to view the Recent Import Records page.
Appendix 1: Uploading Files to COS and Obtaining COS Source File Links
2. In the left sidebar, select the Bucket List page, and then click Create Bucket.
3. In the pop-up creation dialog box, specify the required information and click Create.
Note:
The bucket must be in the same region as the TencentDB for MySQL instance.
4. Return to the bucket list, click the bucket name or Configuration Management in the Operation column.
5. On the File List page, click Upload File to upload a single file or multiple files.
6. After uploading the file, locate the target file in the file list, click the ellipsis icon in the upper-right corner, and then click Details.
7. In the basic information section on the object details page, click Copy Temporary Link to obtain the COS source file link of the file.
FAQs
What Should I Do When Importing a SQL File Failed, with the Error Message "Import Initiation Failure (InternalError.UndefinedError)"?
The steps for setting the data import feature are: select a file to import, select the target database, and confirm to import. During the confirmation step, you need to enter the account and password of the current instance. If the input is incorrect, an import initiation failure will be prompted. Please enter the correct account and password during the confirmation step and try importing again. If you forget the password, you can reset the password and try again.