Title: Database Corruption
Last modified: August 18, 2016

---

# Database Corruption

 *  [larryayers](https://wordpress.org/support/users/larryayers/)
 * (@larryayers)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/database-corruption/)
 * Anyone ever have their Mysql wordpress database get corrupted? Mine did last 
   night and I could find no way to repair the damage. I ended up creating a new
   database and re-installing WP. Then spent three hours extracting 65 posts, about
   30,000 words worth, from the corrupted post database file with a text editor 
   and, one by one, recreated the blog postings. What a pain!
 * It made me wonder if one post database file per month might not be a good idea
   rather than just letting the single file grow and grow.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [philpeeps](https://wordpress.org/support/users/philpeeps/)
 * (@philpeeps)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/database-corruption/#post-152814)
 * I have a couple cron jobs set to do nightly backups of my databases…you might
   look into something similar….
 * I just go through about 1x week and delete the old ones….
 *  [DianeV](https://wordpress.org/support/users/dianev/)
 * (@dianev)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/database-corruption/#post-152815)
 * philpeeps, that’s a great idea. Would you care to post the syntax of your shell
   script?
 *  [philpeeps](https://wordpress.org/support/users/philpeeps/)
 * (@philpeeps)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/database-corruption/#post-152816)
 * date=’date -I’; mysqldump -u db_username -pdb_password db_name > /home/cpanel_login_name/
   public_html/backups/wp/xbackup_$date.sql; gzip /home/cpanel_login_name/public_html/
   backups/wp/xbackup_$date.sql
 * around date-I it should be backticks, but this forum won’t show them
 * There is no space between -p and your db_password. Ther eIS a space between -
   u and db_username….
 *  Thread Starter [larryayers](https://wordpress.org/support/users/larryayers/)
 * (@larryayers)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/database-corruption/#post-152896)
 * Hey, philpeeps, I just tried out your script (after my disastrous corruption 
   incident yesterday evening) and it works like a charm! I’m still a Mysql beginner
   and didn’t know about mysqldump, but thanks to you now I do. Now to set up a 
   cron routine…
 *  [e-head](https://wordpress.org/support/users/e-head/)
 * (@e-head)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/database-corruption/#post-152918)
 * If your blog gets tons of traffic, or you have many bloggers, use mysqlhotcopy.
 * It is the safer way of backing up “hot” databases. That is, databases that might
   be currently “in use” by a commenter or a blogger.
 *  [philpeeps](https://wordpress.org/support/users/philpeeps/)
 * (@philpeeps)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/database-corruption/#post-152923)
 * so use the same syntax, just replace mysqldump with mysqlhotcopy?
 *  [DianeV](https://wordpress.org/support/users/dianev/)
 * (@dianev)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/database-corruption/#post-153419)
 * Here’s a *nix cron shell script
 * click the **Cron and Database Backups link**
    [http://developedtraffic.com/resources/mysql-database.php](http://developedtraffic.com/resources/mysql-database.php)
 * I’d give the direct link to Cron and Database Backups, but I’m probably going
   to move that to a different page, as I’m seeing good tech stuff buried wherever
   in the blog.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/database-corruption/#post-153420)
 * Just a thought, but you might want to read through “repair your tables” at: [http://www.tamba2.org.uk/wordpress/](http://www.tamba2.org.uk/wordpress/)

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Database Corruption’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 5 participants
 * Last reply from: [James Huff](https://wordpress.org/support/users/macmanx/)
 * Last activity: [21 years, 2 months ago](https://wordpress.org/support/topic/database-corruption/#post-153420)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
