SELECT ID, COUNT(ID) AS c FROM wp_posts GROUP BY ID HAVING c > 1
#1062 - ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '6168' for key 'PRIMARY'
CREATE table wp_posts_copy LIKE wp_posts;
ALTER TABLE wp_posts_copy ADD PRIMARY KEY (id);
INSERT IGNORE INTO wp_posts_copy SELECT * FROM wp_posts; -- INSERT INGORE вставит только по одному экземпляру id.
DROP TABLE wp_posts;
RENAME TABLE wp_posts_copy TO wp_posts;