I've been running a Wordpress blog around six months now. I had a problem a few nights back that prevented me logging into Wordpress.
As a Wordpress newbie, I followed the Wordpress guide for backing up the MySQL database. I saved the xxxxxx.sql backup file to disk. As a precaution, I also copied all the blog entries and photos I found, along with the blog text.
I was running Wordpress 2.6, and decided to upgrade to the latest 2.85 version. After installing 2.85, I followed Wordpress upgrade guide which described the procedure for restoring a backed up database. It didn't work. Ideally the restore would have run as the guide described.
I put these notes together for guidance the next time I need to upgrade, backup, restore. Hopefully these may help some poor soul who's having Wordpress dB problems.
Backing Up Wordpress MySQL Database
The back up process is a 2 or 3 stage process. All text and links are stored in a MySQL database, and you must back it up or lose all your blog entries. All the text, everything you write, along with the links, are stored in a MySQL database.
Stage 1 - Copy MySQL database
Stage 2 - Copy Wordpress folder/files
Stage 3 - Restore MySQL database
Stage 4 - Restore Wordpress folder/files
It goes something like this:
1. Back up MySQL database using phpMyAdmin
2. Copy backed up xxxxxx.sql database file to safe location
3. Copy Wordpress folder to safe location
4. Install new version of Wordpress (if needed)
5. Restore MySQL using phpMyAdmin
6. Copy wp-config file (to new install)
7. Copy uploads folder (to new install)
8. Copy themes folder (to new install)
9. Copy plug-ins folder (to new install)
To start the back up process you need to find MyPHP-Admin and launch it. The links to start it will be buried somewhere with your MySQL stuff. You'll have to go to your hosting control panel and dig around in the MySQL section for a link or button to start it.
Here's the official Wordpress backup page. With phpMyAdmin running, follow these instructions and complete the MySQL backup.
Wordpress have a more detailed Upgrade page. Its useful and worth a read.
Next, find the directory where your Wordpress files are located on disk and copy all the files located there. They're in a folder called Wordpress. Copy this folder to your computer's hard disk. This holds all the images and some config details about your blog. The most important are:
wp-config.php contains data the MySQL database. Namely which database contains our data, the username and password to accesss the database. We need to copy this data from the old MySQL config file to the newly installed one.
To avoid confusion I renamed my old config file wp-config-2.6 and copied the new one to wp-config-2.85, so I had an original copy in case I made any errors.
Open the original-2.6 config file in Emacs, Notepad or similar text editor, and open the new wp-config.php file side by side. The most important lines we need to copy are:
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
Copy the data across to the new config file and save it.
Copy wp-content/uploads folder (contains your images)
Copy wp-content/themes folder (contains your themes)
Copy wp-content/plug-ins folder (contains your plug-ins)
Surf across to your blog and see if it works. If you hit problems the Wordpress support forums is a good starting place.
I found a Wordpress page to Back Up Your Wordpress Site. Its worth a read.