I have a feeling it has to do with the one database, but I don’t see
any errors that would indicate so.
Yes, and apparently the structure of the WordPress posts table (wp_040skcp8g2_posts
) in the problematic site is corrupted.
More specifically, indexes such as the primary key are missing, so you need to add them back ASAP:
-
See line 26 at https://pastebin.com/CGGv5q4N which is
[Key] =>
and should instead be[Key] => PRI
and on line 28, it should be[Extra] => auto_increment
. -
Try running
SHOW INDEXES FROM wp_040skcp8g2_posts
via phpMyAdmin and you’d notice the table indexes are missing.
And I don’t know how come the indexes are gone, but I would scan the site for possible security loopholes and then ensure that WordPress core, plugins and themes are up-to-date. I might also change my WordPress/cPanel/FTP/SSH/etc. passwords.
As you can see there are no visible errors, and it looks like the post
should have been assigned a post ID, because it’s in the DB, but it’s
always post ID 0.
The post ID field was supposed to be the primary key with the value being auto-incremented for every INSERT operation, but as I said above, the primary key is missing and the ID field is also no longer auto-incremented and therefore, the post ID always a 0, i.e. zero.
So you really need to fix the table structure and ensure the other (WordPress) tables have a good structure as well.
And for example, to add the primary key, you could do ALTER TABLE wp_040skcp8g2_posts MODIFY ID bigint(20) unsigned NOT NULL auto_increment, ADD PRIMARY KEY (ID)
.
However, if you need further assistance with that (adding back or fixing the indexes), try asking on https://dba.stackexchange.com/, or Stack Overflow? 🙂