Export MySQL tables to a single SQL file

Updated at:

This topic explains how to export tables from your Web Hosting MySQL database to a single SQL file.

Prerequisites

SQLyog is installed on your local computer.
Note You can download it from the SQLyog official website.

Background

  • When you download a database backup file from the Web Hosting management console and extract it on your local computer, each table is saved as a separate SQL file.
  • To export all tables from your database into a single SQL file, you must use a MySQL client. This topic uses SQLyog as an example.

Procedure

  1. Obtain the database connection information.
    1. Log on to the Web Hosting management page.
    2. Find the Web Hosting instance and click Manage in the Actions column.
    3. In the navigation pane, click Database Information.
    4. On the Database Information page, view the connection details.
      Note If you forget the database password, you can reset it. For more information, see Reset the password of a Web Hosting database.
      数据库
  2. Start SQLyog on your local computer.
  3. In the Connect to My SQL Host dialog box, click New.
  4. In the New Connection dialog box, enter a name for the new connection and click OK.
  5. In the Connect to My SQL Host dialog box, enter your database connection details, and then click Test Connection.

    The following table describes the parameters:

    ParameterDescription
    MySQL Host AddressEnter the database endpoint address.
    UsernameEnter the database username.
    PasswordEnter the database password.
    DatabaseEnter the database name.
  6. In the Connection Information dialog box, click OK.
    The dialog box confirms a successful connection. The MySQL version is 5.7.25-log.
  7. In the Connect to My SQL Host dialog box, click Connect.
  8. In the navigation pane, right-click the database name, and then choose Backup/Export > Backup Database As SQL Dump....
  9. In the SQL Dump dialog box, configure the parameters and click Export.
    In the export type drop-down list in the upper-right corner, select Structure and Data.

    The key parameters are as follows:

    • Database Name: Select the name of your Web Hosting database.
    • Export to: Specify the local path where you want to save the exported SQL file.
    • Objects: Select the checkboxes for table, view, stored procedure, and function.

Results

The database is exported to a single SQL file.

You can find this file in the local path specified during the export.