Contact
Site: US UK AU |

How to export and import MySQL tables via CLI/SSH

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

ATTENTION: This method requires SSH access. Nexcess Classic (non-Cloud) clients 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]

  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.

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 the Client Portal.

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.