Migrate: Media Temple Grid Server to Dedicated Virtual

The migration from Media Temple’s Grid Server to the Dedicated Virtual web hosting solution was surprisingly easy. With initial pointers from Paul, I was well on my way to successfully migrating four hosted sites from the "Grid" to the DV. Media Temple’s Dedicated Virtual hosting plans provide a considerable amount of flexibility – including root access – which is ideal for users who want complete control of their own or client(s) websites.

Unfortunately, the (mt) Knowledge Base is a little thin and may not be of much help for those that may feel disoriented or overwhelmed by the task of moving from the Grid Server to a Dedicated Virtual. I know I was. Fortunately, with a little trial and error, reading, and a successful migration, the following was documented in hopes of helping others who plan on making the move. Much praise for Plesk – the control panel software of choice provided for Media Temple customers.

For the following example, we’ll move an entire WordPress driven site from the Grid to the DV. We’ll take this opportunity to install a fresh new install of WordPress. The beauty of moving to a completely different server is that a) you have an opportunity to start afresh, and b) you can tweak and prepare your site before DNS changes are made (any and all improvements that you’ve pushed back due to procrastination or sheer laziness can finally be completed).

The general intent of this tutorial is to serve as a reference for any website owners anticipating a move from a current hosting solution to a second, third, or fourth.

Check-list: What do I need to do?

  • Export your WordPress database using phpMyAdmin [#]
  • Download important files and directories – .htaccess, wp-config.php, /wp-content/uploads, /wp-content/plugins, and /wp-content/themes [#]
  • Upload a new WordPress installation into your new server httpdocs directory [#]
  • Create database to match wp-config.php settings or start new [#]
  • Upload important files and directories – .htaccess, wp-config.php, /wp-content/uploads, /wp-content/plugins, and /wp-content/themes [#]
  • Import old WordPress database via SSH [#]
  • Double-check website before requesting DNS change [#]
  • If everything checks out as it should, decide what hours generate the least amount of traffic and request DNS change to match [#]

Export your WordPress database

MySQL Admin - Media Temple WebControl

In order to successfully move your WordPress posts, comments, and configuration settings, you’ll need to export your existing database (SQL). This can be done using the phpMyAdmin interface accessed via the Grid Server Account Server WebControl > MySQL Admin.

phpMyAdmin - Export tab

Once inside phpMyAdmin, locate the Database drop down menu and select the associated WordPress database for export. In the following view, find the ‘Export’ tab.

phpMyAdmin - Export web interface

Within the ‘View dump (schema) of database’ view, ensure that the following parameters match:

  • Export – If this database is used for nothing other than your WordPress installation, click the ‘Select All’ option which will highlight all WordPress related tables preceded with “wp_”. Ensure that the SQL radio button is ticked.
  • SQL Options > Structure – Ensure that the following and nothing else are selected: ‘Structure’, ‘Add DROP TABLE’, ‘Add AUTO_INCREMENT value’, and ‘Enclose table and field names with backquotes’.
  • SQL Options > Date – Ensure that the ‘Data’ box is checked. Also check ‘Complete Inserts’ and ‘Use hexidecimal for binary fields’.
  • Scroll down and check the ‘Save as file’ box. Leave the default file name template and compression settings and click the ‘Go’ button. phpMyAdmin will then prompt you to save a backup of your database. Do so and move to SQL file to a safe directory on your computer.

You have successfully backed-up your entire WordPress “core” – settings, configurations, users, categories, links, posts, and comments. For future reference, repeat the above steps in order to backup your installation of WordPress on a regular schedule.

Download important files and directories

Unless you have spent a considerable amount of time customizing core WordPress files, I think it is [generally] a good idea to take this opportunity (of moving to a new server) to install the latest distributions. Considering it is safe to assume that you have uploaded countless images and files for sharing to your exhsiting server, it would only make sense to move specific files or folders to the new. In order to do so, you’ll need to fire up your favorite FTP utility in order to download files locally to your computer.

Aside from whatever personal files or directories you have created that you wish to bring with you, I recommend that users quadruple check that they’ve saved the following:

  • .htaccess – This file is hidden by default. In order to copy the contents of this file – rewrite or redirect rules – you’ll need to show invisible files. Most FTP utilities offer the option under their ‘View’ menu option.
  • wp-config.php – This file contains the important bits of your installation including your database name, location, username, and password. If you plan on creating your new database to match the settings found in this file, save a local copy of this file to upload back into your WordPress directory.
  • /wp-content/uploads – Extremely important directory! Any files or images that you have uploaded using the WordPress uploading interface (post editor) are stored in this directory. Forget to move this and you’ll discover all your images for posts (after database import) will be missing.
  • /wp-content/plugins – Personally, I download my entire plugins folder to re-upload. If my site is working as it should with the existing plugins, why leave them out of the download / re-upload workflow when moving to a new host? Once you’ve imported yoru backup database, your WordPress install will look as it did on the previous host. If plugins are missing from the new installation, your site might not function as it should from the get-go.
  • /wp-content/themes – The presentations folder for WordPress containing all the themes you’ve amassed over the years.

Upload a new WordPress installation

Download the latest release of WordPress from the Download page. The current release as of this posting is version 2.1 which offers a handful of updates from previous versions. Check out the release notes here.

Downloaded WordPress directory

Remember when we downloaded all the important files and folders from the previous step? Drop them back into this new WordPress download in preparation for upload. Ensure that wp-config.php remains in the root directory while plugins, uploads, and themes are placed in the wp-content directory. Once all the files are where they should be, open your FTP utility and upload the files and directories to your new server.

Create your WordPress database

The first few minutes after logging into Plesk may be somewhat overwhelming. Worry not as Plesk is far simpler to navigate and use than you would ever imagine. By moving forward with the creation of your new WordPress database, we’re going to assume that you’ve familiarized yourself enough to understand the relationship of “Clients” and associated “Domains”. Moving forward, open the domain for which WordPress is to be installed. You’ll want to look for the “Services” section of the page.

Plesk Services Options

Within the Services pane, select Databases. In the next view, select Add New Database. You will then provide the Database Name, ensure that type is MySQL, and make sure that Database Server is Local MySQL Server. Click OK. After the database is created, you’ll need to create an associated username and password. The database name, username, and password will then need to be referenced in the wp-config.php file located in your WordPress root directory to be uploaded to the new server.

Upload important files and directories

All of the previously downloaded files & directories including the newly edited wp-config.php file should then be uploaded to your new server. Take note to ensure that the original WordPress file directories are as they should be /wp-content/uploads, /wp-content/plugins, and /wp-content/themes.

Import old database via SSH

Chances are high that your database backup exceeds the 2MB upload limitation of phpMyAdmin. Fortunately, the database can still be upload – with a bit more finger work. You’ll need to complete the import via SSH (Secure Shell). In order to do this, your backup must be on your server. Upload your database into the root directory of your domain and open a command line utility. OS X users can open Terminal. Type the following to open an SSH session and hit [enter]. You will be prompted to enter your SSH/FTP password:

$ ssh username@domain.com

Where username is your SSH username and domain is the associated domain that you wish to import an existing database into. Most likely will need to be an IP due to your domain not receiving the DNS change. Once logged in, you’ll need to navigate to the directory where the backup database was uploaded. In this scenario, your root HTML directory. If you are unsure of the correct path, simply type the following followed by [enter]:

$ ls

ls is an abbreviation of list segments. Entering ls followed by [enter] will present you with a list of directories & files on your server. In the case of Dedicated Virtual users, cd or change directory where the backup exists:

$ cd httpdocs

Now that you are in the correct directory, you can import your WordPress backup into an existing [empty] database on your server:

$ mysql -u username -p databasename < backup.sql

Enter the string above and hit [enter] after which you will be prompted for the password for the existing database. Username refers to the username associated with the database, databasename the name of the existing database, and backup.sql being the backup uploaded via FTP from the old server. [More Info] Once the import is complete, logout and delete the backup from your HTML directory.

Double-check your website before requesting DNS change

Now is the time to double-check your import and installation to ensure that everything is in working order. Because your domain is not yet pointing towards your new host, you’ll need to navigate using the IP or by selecting the ‘Site Preview’ in Plesk. Now is also a great time to create your Mail aliases or accounts for forwarding or setup via Plesk in order to ensure that no emails are lost during the DNS change.

The best time to request a DNS change?

The best time of day to request an official DNS change from your host depends on your readership. Reference your statistics tracking package for a better idea of what hours net the least number of readers. Doing so will ensure that any downtime as your DNS resolves will not result in disoriented and / or confused readers. Recommended time for a DNS change would be between the hours of 2AM and 5AM. Your results may vary.

Discuss - 58 Comments

  1. Jacob Gube says:

    What a wonderful write-up! This is a very detailed account and I’m in the exact same position of migrating a WordPress from a gs to a dv server. Excellently written and I would hug you if I ever get the chance, saves me a lot of time in researching!

  2. [...] Migrate: Media Temple Grid Server to Dedicated Virtual (tags: hosting server wp webdesign) Posted in del.icio.us links. [...]

  3. Mike says:

    Hey Derek – Do you know of any good programs that are able to import and split up .sql data? I’ve been trying to import my old posts, which total about 3.5 megs (1.5 over the 2mb phpmyadmin limit), and I’m thinking about just importing all that old data (posts/comments) table by table. I’m on MT’s DV, but don’t have SSH… even after enabling root access and developer tools and putting in a tech support ticket for my account. Last time i called MT, the waiting queue on the phone was 20 MINUTES!!! It’s driving me rather nuts and I’d really just like to get that old material back up. Any advice is much appreciated. Thanks =)

  4. Derek says:

    SSH support should already be enabled, it is requesting your root password that requires contacting support. I would continue to try emailing support (ticket) for your root password. In the mean time, if you are impatient, you can always export a few tables at a time (while staying under the import limit).

  5. Mike says:

    Thanks so much for taking the time to write this up and respond to everything! Turns out SSH was forbidden on my server — I swear, I was going ape$#!t over it (“I don’t have the blue SSH button!!!”) — but I got everything enabled, followed your instructions step by step and got everything in place. You rock dude! Thanks a million =)

  6. Derek Sneed says:

    Derek,

    Your parents have great taste in names.

    Just wanted to drop you a huge thank you for doing this. What a huge help this has been to help me feel more confident in my leap from gs to dv.
    I host clients on gs, and really need to get over to dv to do it properly and give them a control panel.

    Thanks so much for your time and for being so involved on responding to comments!

  7. [...] Migrate: Media Temple Grid Server to Dedicated Virtual – Derek Punsalan – 5ThirtyOne (tags: mt mediatemple migration mysql server wordpress resources) SHARETHIS.addEntry({ title: “links for 2009-02-17″, url: “http://www.crawlspacemedia.com/blog/2009/02/17/links-for-2009-02-17/” });   [...]

  8. Mat Packer says:

    Hey Derek

    Great article. I’m actually looking at migrating to a DV service at the moment, currently using MT’s GS service but finding that the db’s are constantly slow which is a pain particularly with WordPress.

    Definitely keeping this handy during the process as MT’s documentation is woeful at best.

    Cheers
    Mat

  9. jenn says:

    Hey there. I am following your steps to migrate my wordpress database to media temple. but you stumped me here:

    “Upload your database into the root directory of your domain and open a command line utility. OS X users can open Terminal”

    What is Terminal and how do I access it?

    Thanks! Jenn

    • Derek says:

      You can find Terminal in Applications > Utilities, or use Spotlight to find the app without browing through the Finder.

  10. Hi Derek-

    Thanks for posting such a comprehensive write-up on this. I was able to get my (gs) site moved over to my (dv) with no issues. Quick question, though:

    Did you encounter the issue where WordPress prompts you to enter your FTP login information when upgrading a plugin? I’ve been doing a bit of research over the past few days, and I understand that it’s because I need to set the owner of the [some files] to the Apache user. Accordingly, it’s my understanding that I need to chown said files to correct this.

    Would you be able to point me in the right direction regarding the command? Since you and I are essentially running in identical environments, your feedback is about as good as I could hope for. Thanks in advance if you can spare a moment of your time.

  11. Yep, that was among the more helpful articles that I’ve found. Thanks for the quick response.

  12. Aaron says:

    This was easily one of the most useful guides I’ve ever found on the web. You saved my life today! Thanks a million!

  13. Eric says:

    Great help. However I’m stopped at “Double-check your website before requesting DNS change”.

    WP-login keeps redirecting me to the URL of the current website (old host). I tried changing the siteurl in the database to https://00.00.00.00:8443/sitepreview/http/domain.com but it redirects to http://domain.com:8443/?previous_page=dom_ctrl instead.

    Suggestions?

  14. Kristian says:

    Hey Derek,

    I presume you never had any permissions issues when moving to (dv)? I’m just in the middle of setting up a test installation of WordPress but no matter what I try WP can’t write files (i.e. install Plugins, upload images etc.) to the /wp-content directory..

  15. Kerri says:

    Thank you so much for your help on this ! Much appreciated !