putty logo

Migrating Your Drupal Database with PuTTY (Telnet/SSH)

putty logo1. Get a copy of PuTTY (free) or another telnet/SSH client of your choice.

2. When you open PuTTY you will see a field for “Host Name (or IP address)” Enter your FTP access Host name here.

Example: servername.pair.com

3. Create a MySQL “Dump File” of Your Database

To move your database from your old Web hosting company to pair Networks, you will have to create what is called a “dump file” of your database, which is basically a copy of your database. Check with your old host on how this would work with their system. Generally, if you run the following command in a terminal window, you will have created a “dump file.”

mysqldump -Qq -hDBSERVER -uUSERNAME -p DATABASE_NAME > sitenamedbbackupdate.sql

You can call the dump file anything that you want.  I suggest using your site name followed by “dbbackup” and then the date so that you can identify the file at a later date.

Replace “DBSERVER” with the server name where the database currently resides. Replace “USERNAME” with your MySQL username, and replace “DATABASE_NAME” with the full name of the database. With most other Web hosting companies, you can leave off the “-hDBSERVER” part, which will make the command default to what is known as the “local host.” Many other Web hosting companies have databases running on the same server as the Web hosting files.

Please also note that when you run this command, you will be promoted for a password. Enter your MySQL database password at this point. Depending on the size of the database, the command may take up to several minutes to run.

The command above will create a file named backup.sql in the current directory where the command was run. Run this command on your old Web hosting or database server. You will then need to upload this backup.sql file to your pair Networks Web hosting account (in your home directory).

4. To move the backup file to a different server enter the command:

scp sitenamedbbackupdate.sql username@nameofserver:~/

5. Upload the Dump File to Your New Web Hosting Account

Use FTP or SFTP to upload the backup.sql file to your pair Networks Web hosting server. After uploading the file, connect to the hosting server using SSH. After you are connected, you can transfer the contents of the backup.sql file into your new empty pair Networks database by entering the following command in a terminal window:

mysql -hDBSERVER –uUSERNAME -p DATABASE_NAME < sitenamedbbackupdate.sql

Replace “DBSERVER” with your pair Networks database server name. Replace “USERNAME” with your pair Networks MySQL username, and replace “DATABASE_NAME” with your new pair Networks database name. Refer back to the pair Networks database information page for this information.

If it is a really large database it may get cut off mid transfer by a reaper program.  In order to circumvent this add “nice -20” to the command line.  The upload will be a bit slower, but will not get cut off.  Your command should look like this.

nice -20 mysql -hDBSERVER -uUSERNAME -p DATABASE_NAME < sitenamedbbackupdate.sql

Please also note that when you run this command, you will be promoted for a password. Enter your MySQL database password at this point. Depending on the size of the database, the command may take up to several minutes to run.

Zeen is a next generation WordPress theme. It’s powerful, beautifully designed and comes with everything you need to engage your visitors and increase conversions.