How to solve ‘You do not have sufficient permissions to access this page.’ in WordPress

I have been getting the following error because I changed the database table prefix

You do not have sufficient permissions to access this page.

The cause of the problem is that you have changed the database prefixes but still, some of the word press config is tied down to the previous prefix (wp_ or something)

Just execute the following two queries

-- Replace 'prefix_' with your actual prefix
UPDATE `prefix_usermeta` SET `meta_key` = REPLACE( `meta_key` , 'wp_', 'prefix_' );

-- Replace 'prefix_' with your actual prefix
UPDATE `prefix_options` SET `option_name` = 'prefix_user_roles' WHERE `option_name` ='wp_user_roles' AND `blog_id` =0;