• Somehow my wp_postmeta table lost its primary key and auto-increment some time in the past. The table now has a giant stack of meta_id entries set to 0. Is there a way to change their meta_id value so I can re-key the table and set it to auto-increment again?

    Thank you,

    Judah

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Nothing that you’d do inside WordPress. You’d have to fix this up via SQL coding and detective work. Does the problem go too far back to consider restoring the database from a backup?

    Thread Starter judah75

    (@judah75)

    Thank you for your reply, Steve. I was in myphpadmin when I found all of the meta_id entries. At this point, I think this may be easier than trying to go to a backup.

    Thread Starter judah75

    (@judah75)

    So, anyone know of a way to (a) change the meta_id of a row if the current meta_id is 0, (b) save all rows with a meta_id of 0 and re-enter them with a new meta_id value so that the originals can be deleted?

    Thank you.

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

The topic ‘Re-keying a database table’ is closed to new replies.