Recently I updated WordPress theme, the theme Zephyr requires at least mysql 5.6 and PHP 7, so I had to upgrade these environment. The environment was outof date secense last maintenance, I decided to update the lnmp environment and import the WordPress database after upgrade.
To backup WordPress data is not very hard, just be careful about your database, config file, and media files.
After upgrading, I import the whole database, but find a error notice when I create new post “You are currently editing the page that shows your latest posts“.
This problem should appears only when your write permission incorrect, but I checked the account and the permission of files, it works fine. And I can even edit settings of theme. That means that, some thing wrong in some table of database. After simply searching, I found all the post are stored in [wordpress_prefix]_posts, in the Structure of a normal table should exist a Primary Key with auto increment named “ID”, if not, this problem will happen.
So we can resolve them with following method:
- directly change the property of the key:
switch to the Structure tab, click Primary in the right to set it as a Primary Key;
click Change and select A_I to enable AUTO_INCREMENT.
- try to import the table again:
choose the invalid table, click Drop;
import the table, note: UNCHECK the box of “Do not use AUTO_INCREMENT for zero values”
I cannot resolve my problem with 1st method, I had to delete the table and reimport the table.
After fixing, usually the problem will be resolved.