We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.

Your Digital Commerce Experts
Nexcess Logo

How to export tables and import MySQL tables via CLI/SSH

September 11, 2019

This method requires SSH access. Nexcess clients on physical (non-cloud) servers must first enable SSH access and adjust their firewall settings in SiteWorx; Cloud accounts have SSH enabled by default.

  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]
  2. Enter your password when prompted.

  3. 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
  4. Transfer the compressed file to the new server using FTP.

  5. On the new server, decompress the file:
    tar zxf [dumpfilename].tar.gz
  6. Launch the import process:
    mysql -u [username] -p [database_name] < [dumpfilename.sql]
  7. Enter your password when prompted to begin the import.

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

Other 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 your Client Portal.

Jason Dobry