Skip to content

Instantly share code, notes, and snippets.

@maravedi
Last active August 29, 2015 14:13
Show Gist options
  • Save maravedi/2b4e76fd96fb5bf11f67 to your computer and use it in GitHub Desktop.
Save maravedi/2b4e76fd96fb5bf11f67 to your computer and use it in GitHub Desktop.
Copying your MySQL Database from Bluehost using SSH

I retrieved this information from Bluehost and from StackExchange.

#####1. First, SSH to your domain:

ssh bluehost_username@bluehost_domain.com

#####2. Next, execute this command:

mysqldump -p -u username database_name > dbname.sql

Note that you need to use the username/password combination for MySQL, not your SSH credentials. Keep in mind that this will dump your database to the file 'dbname.sql' in your current directory.

#####3. Now, exit out of the SSH session.

#####4. Execute this command:

scp bluehost_username@bluehost_domain.com:/home1/bluehost_username/dbname.sql /path/to/destination

This will copy your mysqldump file using SSH protocol to the path you specify onto your local machine.

#####5. Next, create the corresponding datbase in your local MySQL if it isn't already there.

#####6. Finally, import the file into your MySQL using this command:

mysql -p -u username database_name < dbname.sql

You will use your local MySQL credentials for this. These will likely be different from those of your Bluehost MySQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment