Recording about importing WordPress database

Recording about importing WordPress database

IT, Others

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:

  1. 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.
  2. 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.

Amefs, EFS, Wordpress
Previous Post
l-smash GUI 2 (WPF)
Next Post
QuickBox CE vs Pro: Which Is Better?

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

keyboard_arrow_up
Exit mobile version