Recently, I shifted four MovableType blogs to my present host, Bluehost. These were four separate installations, on a personal unlimited license. The existing databases — the ones to be moved — were heavily populated: lots of plugins, customizations, plenty of data, including pictures and long blobs of text. I also had three or four users per blog.
The problem was this: how best to seamlessly migrate the blogs, retaining users, passwords and all customizations, without having to reconfigure MovableType from scratch?
After some trial-and-error, I figured out a way. I don’t claim that this is the best, or even the only, way in which to do this, but it worked for me and should work elsewhere, as long as the new host meets certain requirements (listed below). Here’s my recipe for shifting MovableType to a new host, based on what I did.
First, some assumptions:
This is critical. Log in to your existing MySQL and export the entire MT table. I prefer to do two exports, one each for the data and the table structure. But that’s only because it’s easier to upload at the other end. Remember to export with the create tables and inserts ticked on.
On your new host, upload and install MovableType. For the upload, I strongly recommend using the Cpanel File Manager. It allows you to upload easily right from your browser, without going through an FTP client, and, more importantly, has a nifty built-in unpacking utility that will unzip/unpack your MT files. Remember also to upload any customizations and plugins you may have made.
What I do is this:
Tip 1: If you’re as much a maniac as I am about using MT Plugins, then you’ll soon have realized that it’s damn near impossible keeping track of what goes where — the folder hierarchies, the customized files, etc. Besides, I also customize some of the core libraries so that my uploads go to pre-defined directories and all uploads come up with pre-designated code. If I muddle all this with a default MT distribution, I’m bound to lost track of some file essential to a plugin. So what I do is to keep a separate folder called mt on my local machine, and store all the plugins and customizations in that, preserving their required folder structures and placements. Then I create a tarball of this entire folder. Now, when I need to ‘customize’ a new MT installation, I have only to upload this folder and unpack it. Since the core distribution is always unpacked to a folder on the root called mt, unpacking the customizations-folder from the root (using Cpanel) will automatically add the plugins and customizations at their appropriate places.
Tip 2: to quickly create tarball files:
- Use 7-zip (freeware) to create a .tar file;
- Use Win-GZ to turn the .tar into a .tar.gz file. Download Win-GZ
I’m not going to get into the details of the MT installation and initialization procedure, which are well set out in the MT documentation. Remember only that before you install MovableType, you must create the necessary database, database user, and add the user to the database with full privileges. The Cpanel interface is quite intuitive for that. Remember to update your mt-config.cgi as [documented][9].
Okay, now that you’ve uploaded MT, your customizations and plugins and set all the correct permissions for the various .cgi files and such, initialize the system. After that, you’ll log in to the default MT interface using, of course, the default login (Melody) and password (Nelson).
Okay, you’re in. First off, create a new user, preferrably using the same login and password you had earlier. Remember to give this new user (you) full access to the default blog, ie, all privileges. Also remember to rename the default blog. Do one rebuild. I don’t think it’s strictly necessary, but it doesn’t harm. Don’t worry about paths and settings at this stage.
Now log off as Melody Nelson; log in again using the new user you created. Go to the authors page and delete Melody Nelson as a user.
Log off and close this browser window. Onward!
I forgot to do this, so I’m making a note of it, though it’s self-evident. Rememebr to upload all the additional files for your website including:
You can upload and unpack a zip file of these files, or use an FTP client (I use CuteFTP).
Here’s the next nifty bit. Enter your new host’s Cpanel again. Go to the MySQL page, and from there to the PHPMyAdmin page. You should be in your database. You may have to select your database if your host allows more than one, from the drop-down list. Select it.
Now select all the tables in the database and drop (read, delete) them. Open up a good text editor — I use TextPad — and open the MySQL table-structure file you exported from your previous installation. You can upload it directly into your MySQL database using the import function or, alternatively, use the SQL Query function and copy the entire table into it. Since your export has the create table and insert into lines in it, this will replicate your entire earlier table structure.
Do not repeat with the data export file just yet. You need to edit this file before you upload/insert the data (populate the table).
The critical thing now is to change the paths to your templates in your exported data file because it’s extremely unlikely that your earlier template-paths match the paths on your new host.
For example, earlier path name:
/home/net/somehost/domain/html/templates
While the new path name might be
/home/accountname/public_html/templates
Ideally, you should do a search-and-replace for the old path names and substitute them with the new path names in the exported data file.
Done? Fine. Now in PHPMyAdmin, upload or insert the contents of your freshly-edited exported-data file into MySQL.
That’s about it! Try logging in now, with the username and password you used on your previous host — you should be through without any difficulty. Remember to do one full rebuild.
All this sounds terribly complicated, but, believe me, it’s a whole lot simpler than trying to re-configure the MovableType installation from scratch.
Lastly, one important thing to note: do not try and merely shove the exported table/data into the database of the new host. You just won’t be able to access the MovableType interface, no matter what you do. You have to go through the process of installing and initializing the new MovableType installation, logging in, adding a user and so on, as described above. Frankly, I understand the first bit, but don’t quite know why it requires you to log in and add a user. But that’s a small thing, given the huge saving in time and effort. Doing it like this, I was able to move all four installations over to Bluehost in less than 30 minutes. Doing them over would have taken three days.