Contact
Site: US UK AU |

How to import and export MySQL databases

How to import and export MySQL databases 

Overview
This article explains how to import and export MySQL databases with the phpMyAdmin control panel in SiteWorx and with the MySQL CLI.

Definition

The import and export functions within phpMyAdmin give you an easy way to restore or migrate databases. We recommend you run this process in a test environment before committing to any permanent changes.

Exporting tables and importing tables with phpMyAdmin

This section outlines how to perform database exports and imports by using phpMyAdmin through SiteWorx.

Exporting tables

You can export MySQL databases using phpMyAdmin from your SiteWorx account with the following procedure:

  1. Log in to your SiteWorx account.

  2. On the left, select Hosting Features > MySQL > PhpMyAdmin (Figure 1).

Figure 1. Hosting Features > MySQL > PhpMyAdmin selection in SiteWorx.

  1. Select the correct database from the list on the left (Figure 2).

Figure 2. Database selection in phpMyAdmin.

  1. Select the check box corresponding to the desired table from the Table List, or click Check All (Figure 3).

Figure 3. Table check boxes and Check All selection in phpMyAdmin.

  1. From the With selected list, click Export (Figure 4).

Figure 4. With selected > Export selection.

  1. Under Export Method, leave the Quick radio button selected.

  2. Under the Format list, select your desired format.

  3. Click Go, choose a location, and click Save.

Importing tables

You can import MySQL databases using phpMyAdmin from your SiteWorx account with the following procedure:

  1. Log in to your SiteWorx account.

  2. On the left, select Hosting Features > MySQL > PhpMyAdmin (Figure 5).

 

Figure 5. Hosting Features > MySQL > PhpMyAdmin selection in SiteWorx.

  1. Select the correct database from the list on the left (Figure 6).

Figure 6. Database selection in phpMyAdmin.

  1. Click Import (Figure 7).

Figure 7. Import selection in phpMyAdmin.

  1. Under File to Import, click Choose File and select the file to be imported

    6.  Click Go (Figure 8).


Figure 8. Go button.

Exporting tables and importing tables with MySQL CLI/SSH

This section outlines how to perform database exports and imports with the MySQL CLI:

  1. SSH into the server and enter the following command, but remove the brackets and replace the placeholder text within those brackets:

    mysqldump -u [username] -p [database_name] > [dumpfilename.sql]

  1. Enter your password when prompted.

  2. To accelerate the upcoming transfer to the new server, execute the following command, but remove the brackets and replace the placeholder text within those brackets:

    tar zcf [dumpfilename].tar.gz [dumpfilename].sql

  3. Transfer the compressed file to the new server using FTP.

  4. On the new server, decompress the file:

    tar zxf [dumpfilename].tar.gz

  1. Launch the import process:

    mysql -u [username] -p [database_name] < [dumpfilename.sql]

  1. Enter your password when prompted to begin the import.

  2. When you see the ready cursor, the import has finished.

External resources

For the complete MySQL documentation, refer to the MySQL development website.

For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

Article Rating (2 Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
How to secure your SiteWorx account
Added on Tue, Dec 9, 2014
How to purchase a Wildcard SSL certificate
Added on Wed, Jan 14, 2015
How to create a subdomain with SiteWorx
Added on Mon, Aug 5, 2013
How to add FTP accounts with SiteWorx
Added on Mon, Jun 11, 2018
How to download backup files with SiteWorx
Added on Tue, Aug 6, 2013
How to show running MySQL queries
Added on Fri, Nov 13, 2015
How to view website statistics with SiteWorx
Added on Mon, Aug 5, 2013
How to change PHP versions in SiteWorx
Added on Wed, Oct 26, 2016
What is MySQL Replication?
Added on Thu, Aug 28, 2014
How to change permissions for MySQL users
Added on Mon, Jul 29, 2013