Importing mysql file to domain not yet on Dreamhost DNS

Scenario: Migration of Wordpress site from my old ISP to Dreamhost. DNS is not yet moved to Dreamhost. Need to know how to dump and load MySQL data (see question at the end)

From test site on Dreamhost:

To my main domain*:

  • NOTE:
  • As many of you know, since DNS has not been moved (from old ISP to Dreamhost), the “domain” is really just a folder on Dreamhost server (something like “/home/”).

Since DNS is not moved, I can’t get to: (again, since this will redirect it to my old ISP).

I have already dumped the mysql file from

How do I upload it to Can I do this from ssh session on Unix CLI by logging to MySql interface?

thanks for the responses!

Both hostnames ( and refer to the same MySQL server, so there’s nothing to move. If you were to switch your DNS over and connect to phpMyAdmin on, you would see all of the exact same databases already there.

hi Andrew,

Maybe I did not explain it clearly or don’t understand the “moving a new and active domain to Dreamhost” clearly. I would reason that most customers, with an active website, when moving to Dreamhost has gone through this same process to some degree. i.e.

  1. You want to create a test site on Dreamhost
    If your domain is, than you would create it as: and relevant MySQL database which can be accessed via (right?)

For a CMS-oriented website, such as Wordpress, this will allow you to test it, make sure the page loads are okay, and that everything looks correct before you move your real domain.

At this point, your domain is still hosted by old ISP. But a duplicate test copy is up on Dreamhosters.

  1. You want to test the domain (while dns is still not moved) on Dreamhost
    From the SSH session, you can see that now you have two folders sitting parallel to each other, which is something like:
    /home/ (this is your real domain once dns is moved)

For this also, you have created a database (Goodies -> mysql databases) and you have created a hostname such as:

Dreamhot, however, allows you to reach to “” (on /home/ even when it is hosted at old ISP. The way you do it is …

  • add in hosts file on your PC/Linux host at home and point the domain to DNS IP of Dreamhost
    (recall, Unix checks /etc/nsswitch.conf where usually it is listed as “hosts dns”. If it is like that, hosts translates to /etc/hosts and dns translates to /etc/resolv.conf. In other words, it will look into hosts file before it gets to DNS stub file)

On my Linux host at home, I can do this with no problem. i.e. in the browser I can pull “” from Dreamhost and not from my real domain from old ISP.

Anyways, in case someone else was stuck at this point, here is how I dumped and loaded MySQL from my database on to my database on (again, the one that is hosted on Dreamhost. The actual domain on old ISP is untouched).

mysqldump -h oldhost -u oldusername -poldpassword olddbname | mysql -h newhost -u newusername -pnewpassword newdbname

In this case, the “oldhost” and “newhost” are the same host - the name of Dreamhost server your domain is being hosted on.

Any database you create for any domain within the account is available to any other domain. Your browser does not need to know where mysql.blah.tld is - that’s just a name that the WP script to uses to connect internally (like localhost).

  1. You don’t need 2 mysql hostnames or 2 databases.

  2. When using the HOSTS hack you don’t even need a dreamhosters sub-domain.

hi sXi,

Thanks for clarifying point 1!

Point 2 was clear to me; I am trying to keep both the (for testing - such as downloading new plugins etc to ensure it does not mess up the format of the main website. So data here will be a subset of the and

Let’s assume that I keep both the databases (accessible either from,, or Unix CLI that I shared in this same thread), what are some of the next steps:

a. Do I need to download and run “search and replace” tool or some plugin that does similar thing, by replacing “” with “” (which will run on the db tables and on static php files across the entire /home/ folder structure?

b. manually and carefully change wp-config.php - adding the right db name/password etc.?

c. Any other points/caveats/gotchas I need to be aware of?

Please share a link if it is already explained somewhere.

Thanks in advance to everyone responding!

What you have outlined appears to be a correct method in your case. There are more than one ways to skin a cat, but I’d do exactly what you’ve listed :wink:

Thanks sXi !!

For the benefit of anyone reading the thread, I was able to make the site work last evening (till what is discussed in the thread; there might be some more challenges ahead). Here are some details if anyone is following this thread. Also, there is a possibility that a few things maybe out of sync since I have done these in bits and pieces and trying to remember the steps.

Few things to keep in mind …

  • From word press point of view, settings are exactly same on and

  • Original site, say, is still hosted at old ISP and nothing is changed there.

  • On Dreamhost, I have setup two parallel sites/folder structure
    /home/ - test site so I can see load time before hosting on Dreamhost, test plugins to ensure it does not mess up site looks etc.
    /home/ - set by Dreamhost and future home of my main website once I move dns to Dreamhost

  • FTP client in use is FileZila though being a nix person, I use SSH whenever I can

  • Set up two database hosts ( and and datbases
    This is setup using: Goodies -> mysql databases

  • Created WP site structure, added posts and pages under ""
    Note: I did a dump and load from old site but the site format looked a bit messed up. Given that the original site is not in WP and WP footprint is very small, I decided to recreate it.

With above in mind, following are the steps:

STEP 1. Copy Wordpress files (themes, plugins, etc.)
Copy everything from /home/ to /home/
a. Login to Dreamhost via SSH and do:

This will copy everything from “” to “

$ cp -rp /home/* /home/

confirm it worked; both of these should look same.

$ cd /home/; ls -l
$ cd /home/; ls -l

STEP 2. Move MySQL data from “” to “

Option 1: SSH to Dreamhost and Dump and Load from nix cli (one step)
$ mysqldump -h oldhost -u oldusername -poldpassword olddbname | mysql -h newhost -u newusername -pnewpassword newdbname

  • In this case, the “oldhost” and “newhost” are the same host - the name of Dreamhost server your domain is being hosted on.
    If this worked, it will copy your entire data to the new db.

You can login to MySQL, pick a table and display something like
show databases;
show tables;
select * from


Option 2: Dump and load using PhpMyAdmin
a. Dump MySQL data from “” to your PC
Many ways to do this. One way is to directly login to phpmyadmin:

You want to export your db content (from all tables) into a .sql file.


  • Userid/pass can be found in wp-config.php
  • Screen shot and steps of Database export are same as:
  • You can edit this file in Notepad or Wordpad and really do all the search & replace of “” with “” and then import this file to “”. However, if your db is big, this can become a tiring process and you may miss something. I don’t recall now if Notepad and Wordpad has a feature that does global search and replace (i.e. once instead of prompting you to change every instance)

b. Upload .sql file to the root of your WORDPRESS site
Use FileZila or any ftp client to move .sql file from PC to Dreamhost to folder “/home/”

You can probably also try this:

and import the .sql file. It might even pick the file from your PC. I didn’t try this but I am fairly sure it works.

STEP 3: Intial Testing of site (while dns is still not moved)
On my nix (linux/unix) host, I added Dreamhost DNS in /etc/resolv.conf, and in the browser pulled it as: It will pull the main page but none of the links will work for now ( you can howver on the categories and it will show still as “”)


STEP 4. Search and replace all instances of “” with ""
For this, I used this tool:

Note: I am sure there are good WP plugins to do just that in a simpler way.

STEP 5. Login to your WP BACKEND and then visit your site from there

Note: I haven’t quite figured out this ritual. Maybe I need to empty cache used by WP Super Cache or any other cache plugins.
However, this does seem to “refresh” links. If I just pulled my site ( on the nix host with temp dns, the links still showed from old “”.

NOTE: At this point, both “” and “” should look exactly the same.
i.e. shows in any browser since it is on the internet. And “” only shows on the PC on which you have set up the temp DNS.


  • Move DNS from old host to new host

Some links I found/gleaned through (helpful if you are moving from godaddy to Dreamhost):