Here is what worked for me. I was moving a wordpress site from one host to a new host.
After coping over the php files and database backup, and updating wp-config.php with the updated database login info, I received this “Sorry, you are not allowed to access this page” error when I would try to access /wp-admin/ after login.
My issue turned out to be the MySQL global database variable:
lower_case_table_names
The old host had this set to 0, my new host had this set to 1.
You can check with:
show variables where Variable_name='lower_case_table_names'
Since this is a global variable, there are limited options for changing this.
For what ever reason, the site I was moving had mysql tables using lower case table prefixes. So rather then wp_users it was: a1b23cd_users
When I searched my mysql backup sql file for the a1b23cd prefix, I would I mixture of “a1b23cd” and “A1B23cd”.
I don’t know how they came to be mixed case, and since the database was set to accept mixed case, this wasn’t a problem previously.
I fixed it by doing a search and replace in notepad++ and replacing all instances of the database prefix with the lowercase version.
Then I restored a new copy of the database, and it works fine now.
None of the long lists of items to troubleshoot this issue mentioned this setting.
I came across it because I noticed the the tablename prefixes I saw in phpMyAdmin were lowercase and the $table_prefix value in wp-config was mixed case. So I started going down this rabbit hole, and fixed it this way.
I hope this helps someone else.
-
This reply was modified 3 years, 6 months ago by
mirx1.