I have a WordPress MU site that I wanted to move to a new server, and here’s how I did it.  I’m writing this because I did it once, and then forgot how to do it again.  I have a mind like a sieve.

  1. First I tarred up all the files for the directory:

    tar cvzf wordpress.tgz wordpress/

     

  2. Then I backed up the mysql database:

    mysqldump -u root -p wordpress > wordpress.sql

     

  3. When you back up a MySQL database it comes out as a simple text file.  You can open it up with a text editor (I have a mac and use TextWrangler).  I then use a simple find and replace in my text editor to find all the old URLs and replace them.  If you’re supper fancy you can use vi (which sometimes I do when I’m really really lazy and don’t want to go into a gui…yes I know that makes me a loser):

    :%s/old.url.com/new.url.com/g

     

  4. The next thing that I did was move the sql file and the tar file over to my new server.  I then created the database in mysql:

    create database wordpress;

    and then imported the mysql export file into the database that I just created:

    mysql -u root -p wordpress < wordpress.sql

    Afterward, I double check that the database really is populated, but that’s because I’m a cautious person.  So I do a really quick:

    use wordpress;
    show tables;

    Before moving on.
     

  5. I then moved the tar file into the web directory and unzipped it:

    tar xvzf wordpress.tgz

    This will unzip all the files and create the wordpress directory.
     

  6. Finally you’ll want to go into your wp-config.php file and look at your database settings.  There is a section that reads:

    // ** MySQL settings ** //
    define('DB_NAME', 'wordpress');    // The name of the database
    define('DB_USER', 'wordpress');     // Your MySQL username
    define('DB_PASSWORD', 'wordpress'); // ...and password
    define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
    define('VHOST', 'no');
    $base = '/wordpress/';

    Using this information you’ll want to create a MySQL user according to this information (or you can create any old user and change these values in the wp-config.php file).  The MySQL query to create the user referenced above is:

    grant all privileges on wordpress.* to 'wordpress'@'localhost' identified by 'wordpress';

    So now you have created the same wordpress user that you had on your other wordpressmu site.
     

  7. At this point I like to double check that everything worked as planned.  You’ll want to go to your new URL and make sure that everything that was there before is there now.  Also tip:  don’t delete the old wordpressmu site until you’re certain the new one is working properly.