[wp-hackers] wordpress import. does it really work?

Kokarn kokarn at gmail.com
Mon Apr 9 22:15:51 UTC 2012


Why wouldn't truncate reset the auto_increment values?

It's not 100% certain that they will but assuming he runs MySQL > 5.0.13
(which i think is a pretty fair assumption) they will be reset AFAIK.

My own tests say they do, the resources i find say they do and the MySQL
documentation for truncate
table<http://dev.mysql.com/doc/refman/5.0/en/truncate-table.html> says
they do.

What am I missing?

On 9 April 2012 21:21, Brian Layman <wp-hackers at thecodecave.com> wrote:

> On 4/9/2012 12:42 AM, Haluk Karamete wrote:
>
>> then run
>>
>> TRUNCATE TABLE wp_links
>> TRUNCATE TABLE wp_posts
>> TRUNCATE TABLE wp_terms
>> TRUNCATE TABLE wp_term_taxonomy
>> TRUNCATE TABLE wp_term_relationships
>>
>> this literally clears the mentioned 5 tables.
>>
>
> Since this has been touched upon several times recently, I want to mention
> that truncating a table does not restore it back to its original state.
>
> The auto increment field in each of the tables is still going to be at the
> next number to be generated.  If you want to empty and reset WordPress's
> tables, try something like this..
>
> truncate table wp_terms;
> truncate table wp_term_taxonomy;
> truncate table wp_term_relationships;
> truncate table wp_commentmeta;
> truncate table wp_comments;
> truncate table wp_links;
> truncate table wp_options;
> truncate table wp_postmeta;
> truncate table wp_posts;
> truncate table wp_users;
> truncate table wp_usermeta;
> alter table wp_terms auto_increment = 1;
> alter table wp_term_taxonomy auto_increment = 1;
> alter table wp_commentmeta auto_increment = 1;
> alter table wp_comments auto_increment = 1;
> alter table wp_links auto_increment = 1;
> alter table wp_options auto_increment = 1;
> alter table wp_postmeta auto_increment = 1;
> alter table wp_posts auto_increment = 1;
> alter table wp_users auto_increment = 1;
> alter table wp_usermeta auto_increment = 1;
>
> Alter to fit your needs.  And yes wp_term_relationships doesn't have an
> auto_increment field. It's not a copy/paste mistake.
>
> Brian Layman
>
> ______________________________**_________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.**com <wp-hackers at lists.automattic.com>
> http://lists.automattic.com/**mailman/listinfo/wp-hackers<http://lists.automattic.com/mailman/listinfo/wp-hackers>
>


More information about the wp-hackers mailing list