There can be multiple reasons for a WordPress database related issue. It can be a single table issue. It can be connection issues etc. You can check the status of the database and its tables with the phpmyadmin.
Another way to check for issues is to use the wp-cli tools. Notice that the wp-cli is installed on all our web hosting servers.
The first command is wp db check:
root@www [/home/max12/public_html/wordpress]# wp db check --allow-root
max12_wp304.wpj1_commentmeta OK
max12_wp304.wpj1_comments OK
max12_wp304.wpj1_links OK
max12_wp304.wpj1_options OK
max12_wp304.wpj1_postmeta OK
max12_wp304.wpj1_posts OK
max12_wp304.wpj1_term_relationships OK
max12_wp304.wpj1_term_taxonomy OK
max12_wp304.wpj1_termmeta OK
max12_wp304.wpj1_terms OK
max12_wp304.wpj1_usermeta OK
max12_wp304.wpj1_users OK
Success: Database checked.
root@www [/home/max12/public_html/wordpress]#
The second command is wp db repair:
root@s04 [/home/max12/public_html/wordpress]# wp db repair --allow-root
max12_wp304.wpj1_commentmeta OK
max12_wp304.wpj1_links OK
max12_wp304.wpj1_options OK
max12_wp304.wpj1_postmeta OK
max12_wp304.wpj1_posts OK
max12_wp304.wpj1_term_relationships OK
max12_wp304.wpj1_term_taxonomy OK
max12_wp304.wpj1_termmeta OK
max12_wp304.wpj1_terms OK
max12_wp304.wpj1_usermeta OK
max12_wp304.wpj1_users OK
Success: Database repaired.
root@www [/home/max12/public_html/wordpress]#
In our example, we use wp-cli as root user. This is why we added --allow-root
parameter.