Moving a MySQL Based Message Board
06 Jan 2006. . . is a huge pain in the ass. A little over a month ago, we decided to move the Blair Wasdin Project (Red Sox/General Baseball) and Chair Chuckers (Celtics/General Basketball) message boards from the old crappy web host they were on to a newer, better web host.
The basics of this are easy:
- Move web files
- Move databases
- Repoint DNS
Simple enough.
And the first step--moving the web files--is easy. FTP down from old, FTP up to new. Easy.
The last step is also trivially easy.
That leaves ...
Step 2. It's a complete bitch. Since most shared web hosts don't give you access to the MySQL server, you can't just go grab the database file and move it. You have to move the actual contents of the DB through SQL insert statements. Create tables and fields, insert data; rinse; repeat. There are some tools to make it easier, bundling the jobs up into a big batch text file, but on a message board with thousands of posts, these files become quite large. Uploading generally causes the remote web server to time out. So you have to break the file up into smaller chunks.
It's just tedious.
I'm sure there's a better way, but I was lazy and this was the best I could figure. In the end, it worked. It just took a long time, and during the time you're moving data, new data is getting inserted. So, short of turning off the board for a period of time, you're simply fighting a losing battle.
Why am I writing about this? Mostly so that I'll remember how to do this if it comes up again. Partially to remind me to think about (and Google) a better way of doing this, should the need arise. And a little bit just to vent about an annoying process and think about a way to improve this situation for shared web hosting customers (which is my job).