While installing WordPress for my blog, I was trying out different subdomain/ folder options.
After final installation when I tried to access the admin page I was being redirected to /wp-admin/profile.php but getting insufficient permission error like shown below.
I could access the front page easily but couldn’t log in admin panel.
I tried changing the permission of WordPress files and directories to 755 but to no avail.
The problem was that while installing WordPress I used different table prefixes each time.
WordPress uses the table prefix for forming the option and usermeta keys name for storing roles and capabilities information.
So in the process, database tables had correct table prefixes but some records in the some of the tables still had old table prefix and this was causing the problem.
To fix the issue you need to update your database using phpMyAdmin or php.
Check in your database in the usermeta and options table if they have correct table prefix in all the fields.
UPDATE `wp_usermeta` SET `meta_key` = replace(`meta_key`, 'old_prefix', 'current_prefix');
UPDATE `wp_options` SET `option_name` = replace(`option_name`, 'old_prefix', 'current_prefix');
Make sure to change old_prefix and new_prefix accordingly.
You can find the current prefix from wp-config.php.
If it’s still not working check all the rows manually and also all the other tables.
This solved the problem for me.
Comments
Post a Comment