I had this problem with one of the WordPress websites I manage. The solution was relatively simple, but it took me quite a while to find it. I want to share the steps I took, in the hope that I can relieve some other WordPress admins of the stress that I went through.
If you’re reading this, I’m assuming you know the details of the problem, because unfortunately, it’s affecting one of your sites. In the interests of clarity and for anyone reading who does not know what I’m talking about, I will explain.
The error occurs when trying to log into the admin area of a WordPress website. The login seems to work fine, but instead of being directed to the admin dashboard, I was greeted by a page with this error message.
You do not have sufficient permissions to access this page
Attempts to log on using different accounts produced the same error.
Enable WordPress Debug
The first useful tip I found whilst trawling the internet for a solution, was to enable WordPress’s debug feature. This is done by changing the setting in the wp-config.php file from “false” to “true”.
The Database Error
With debugging enabled, I went back to my web browser and reloaded the page that produced the aforementioned error message. I was then able to see several occurrences of the error below.
WordPress database error: [Table './wp_usermeta' is marked as crashed and should be repaired]
Please note that this was not the only error revealed by enabling debugging. A couple of other errors where also reported which I assume were not related to the problem in question.
Repair your database
Now armed with the understanding that the “wp-usermeta” table needed to be repaired. I searched the web for how to do it. Repairing a MySQL table is easily done with phpMyAdmin.
From phpMyAdmin, select the relevent database and from the “Structure” tab, click the checkbox next to the affected table. In this case “wp_usermeta”. Scroll to the bottom of the page and choose “Repair table” in the drop down list. Finally, click the “Go” button.
Please note that this is not the only way to repair a MySQL table. This is simply the process I used. I’m sure it is possible to repair a table using the MySQL command line interface and other methods. If anyone would like to contribute alternatives, please post them in the comments section.
All fixed… I hope
With the database table now repaired, the issue should be resolved and access to the WordPress admin section should be possible again. Return to your web browser and reload the page. Don’t forget to change the debug setting back to false when you’re done.
I hope this has helped a least one other person. Please feel free to post comments.