[wp-hackers] best way to reset the database

Tom Barrett tcbarrett at gmail.com
Wed Apr 4 07:45:04 UTC 2012


Inspired by: http://wordpress.org/extend/plugins/wordpress-reset/

I have a theme I use for development that stores the
options/posts/user/whatever, drops the tables, deletes uploads, rebuilds
and inserts the data I want to keep. Not too tricky, but possibly overkill
for hat you want.

On 4 April 2012 08:04, Kokarn <kokarn at gmail.com> wrote:

> Isn't the only problem that you want to totally reset two tables?
>
> In that case you could write a plugin that does "TRUNCATE TABLE wp_post"
> and "TRUNCATE TABLE wp_post_meta".
> That will delete all the data and reset the auto_increment values (if you
> use any version of MySQL and a MyISM db or MySQL >= 5 and an INNODB db)


If you all you want to do is clear out the posts and postmeta tables, then
truncate is your friend. I'd go with this option from what you describe.

-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list