Fix WordPress database error Duplicate entry ‘0’ for key ‘PRIMARY’ for query INSERT INTO wp_posts

Spread the love

It should not have happened, but it happened. I moved my database to a new MySQL server and I was not able to create new posts. WordPress was showing a error saying “This site has a critical error. Please check the email”.

I was also not getting email because of some issue. So to find the exact cause, I used the plugin ‘Error Log Monitor‘ and it listed errors on Dashboard.

The above error could be fixed by enabling the ‘Auto_Increment’ for ‘Id’ field of the wp_posts column.

Cheers and Peace out!!!