Change Wordpress database prefix on PC local-site

Issue Summary

Just created first WP site in Local on my PC. No content added yet, but I want to change the database table prefix. I can’t find clear instruction for this.

Troubleshooting Questions

Are there some clear instructions for how to change the Wordpress Table prefixes?

System Details

-Window 10 PC

Basically just use Adminer (in the Database tab of your site in Local) to edit each table, renaming it with the new prefix. Then go and edit the table prefix in the wp-config.php file.

Thank you Alex for assisting!
I changed the Table prefixes inside Adminer on my Windows PC. I used the SQL command ALTER TABLE table_name
RENAME TO new_table_name; (This appeared to work :slight_smile:

I then changed the wp-config.php file \local-sites\mysite\app\public ($table_prefix = ‘abc_’:wink:

But now I can’t open the Admin of the site. I get the error “Sorry, you are not allowed to access this page.”

Do you have any further solutions?

Thank you!

Sorry, no, I don’t really have further thoughts. Any times I’ve changed database prefixes doing what you’ve done has worked fine.

Thank you Alex for getting on the right track. I have now solved the problem.

There other references to the previous table prefixes lurking within the tables. I did a search to find them:
SELECT * FROM wp_mynewprefix _options WHERE option_name LIKE ‘%wp_%’

Then manually changed each row found with a reference to the old wp table prefix. Hopefully there are no further problems - but this is just on my PC!

It would be helpful if explicit instructions were available for people using Local for the first time.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.