SQL/SSH: Import a Large SQL file Using SSH and the MySQL Command Line

You are here

If you have an SQL file that is several hunded MB that you would like to import to your servers database, phpMyAdmin will not work, as the file will be too large. You can achieve this by doing the following:

  1. Export a copy of the large database as a .gz/.tar/.zip file (should be really compressed). Upload the file to your server and uncompress.
  2. Download the latest version of Git from here: https://git-scm.com/downloads (includes Git Bash). Then upload the file to your
  3. In Git Bash type the following (Make sure your have the correct port number...SSH typically uses Port 2222):
    ssh -p 2222 cpanel_ser_name@your.ip.addr.ess
  4. Enter Password
  5. Navigate to the folder where the file is then type:
    "ls -l" (no quotes) to confirm that the file is there
  6. Then type:
    mysql -p -u database_user database_name < large_database_file.sql
  7. Wait until finished...It's a large file so it will take a while