≡ Menu

Restoring your MySQL database from backup

Should you ever need to recover from a disaster or move WordPress to another server, restoring the data from a backup becomes necessary.

This gets a little tricky if your MySQL database is large, as server time-outs become common. The trick is to to upload the new database in separate chunks.

1. Log in to phpMyAdmin. Select all the tables in your database and do a Drop, then go to the SQL tab.

2. Fire up WordPad on Windows and open the backed up database. SELECT ALL, and Paste it into a new WordPad work file. Remove this from the top:

– phpMyAdmin SQL Dump
— version 2.6.1-pl2
— http://www.phpmyadmin.net

— Host: localhost
— Generation Time: Jun 24, 2005 at 05:14 PM
— Server version: 4.0.24
— PHP Version: 4.3.11

— Database: `yournamehere_data`

CREATE DATABASE `yournamehere_data`;
USE tamba2_data;

3. Select and CUT a first logical chunk out of the work file that’s not too large, and Paste it into the form field in phpMyAdmin. Click Go, and wait for the confirmation of success. (Cutting the data, rather than Copying, ensures that you’re not uploading things twice during this process.)

4. Repeat with then next logical chunk, and continue this process until the entire file has been uploaded.

5. If you’re moving WordPress, browse to the wp-login file, go to Options, and make sure that the Blog Address is correct. If things get complicated, use phpMyAdmin to Browse through the database where you can redefine the Blog Address manually. At this point it’s probably a good idea to redefine and database fields that are specific to the old domain.

6. After this, you may need to run the upgrade.php script in the new location. Be careful that it’s not pointing to the old url.

7. Change the user information in the new location’s admin to avoid cross-ups between the two domains.

8. Lastly, go to the new locations admin Options and verify that the WordPress Address and Blog Address jive.

0 comments… add one

Leave a Comment

Next post:

Previous post: