Changed wp table prefix and now cannot access WP Admin?

For hosting migration or security enhancement you might want to change your Database Tables prefix, if you did so, you will encounter a silly issue where you won’t be able to access your WP Admin again, due to insufficient permission issue.


It’s because WordPress, while being installed, it uses the tables names (including the prefix) in other databases entries values. Really, no idea why it works like that.


You’ll need to modify the values from the database and change the old prefix to new ones, here are 2 SQL queries that should help do that:

‘new_’ is the new table prefix
‘old_’ is the old table prefix

UPDATE new_usermeta
SET meta_key = REPLACE(meta_key,'old_','new_');

UPDATE new_options
SET option_name = REPLACE(option_name,'old_','new_');