[wp-hackers] best way to reset the database
Kokarn
kokarn at gmail.com
Wed Apr 4 07:04:58 UTC 2012
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)
On 4 April 2012 06:05, Daniel Fenn <danielx386 at gmail.com> wrote:
> I'm not at my main computer right now so I can't cook something right
> off the top of my head.
>
> All you do is, install wordpress and set up what need to be in every
> install (user account and so on)
>
> Then you backup the database with mysql or phpmyadmin (if you got
> access to that)
>
> Then you can just use something like mysql -u #username# -p
> #database# < #dump_file# to restore the database.
>
>
>
>
>
>
> On Wed, Apr 4, 2012 at 2:01 PM, Haluk Karamete <halukkaramete at gmail.com>
> wrote:
> > any pointers where I can get a head start with your idea?
> > I'm new to PHP. and I cannot spend too much time getting this from ground
> > up.
> >
> > On Tue, Apr 3, 2012 at 8:33 PM, Daniel Fenn <danielx386 at gmail.com>
> wrote:
> >
> >> One way you could handle this is by installing workpress, set up all
> >> the settings that you need and just backup the table and restore it.
> >>
> >> You should be able to write a php script to delete and restore the
> >> database.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Wed, Apr 4, 2012 at 1:29 PM, Haluk Karamete <halukkaramete at gmail.com
> >
> >> wrote:
> >> > I'm working with a fresh install programmatically.
> >> >
> >> > I create taxonomies, terms, posts, on the fly without the dashboard.
> >> It's a
> >> > process for me with lots of trials and errors.
> >> > Many times, I want to start with a fresh slate.
> >> >
> >> > That's where the question is formed. What's the most effective way to
> >> bring
> >> > the wp to the starting ( well, almost starting ) phase,
> programmatically?
> >> >
> >> > If I drop the database with a mysql statement, wp would create the
> tables
> >> > and that would give me a fresh slate but that would also blow the
> >> bloginfo
> >> > and admin user etc.
> >> >
> >> > All I care is to clean the wp_post, post_meta, where terms and
> taxonomies
> >> > stored. no need to clean the options table.
> >> > If I delete the records, that does not help cause then my IDs won't
> start
> >> > from 0.
> >> >
> >> > What's a good way to handle this?
> >> > _______________________________________________
> >> > wp-hackers mailing list
> >> > wp-hackers at lists.automattic.com
> >> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list