Try a search on Google for this post’s title and you’ll find dozens and dozens of pages referring to this error. Some of them help you fixing it, some of them just link to other pages but none of them makes it really easy for you to resolve this issue fast.
Every time I move a WordPress site to another (sub-)domain, e.g. from blog.example.com
to www.example.com
, using blog_
and www_
as the database table prefix respectively I come across this neat error – it’s this prefix that’s causing trouble.
Basically, this prefix gets hard coded into the database during WordPress’s initial setup. Sure, there might be reasons to do this but even as a developer I must admit that this is a really annoying limitation from a pure user’s perspective.
Solution
The solution is pretty straight forward: just replace occurrences using the old table prefix in your database with the new one. You’ll find them here:
- prefix_
usermeta
- prefix_
user_level
- prefix_
capabilities
- prefix_
autosave_draft_ids
- prefix_
- prefix_
options
- prefix_
user_roles
- prefix_
You’ll have to make sure that prefix is the same.
Fixing it fast
You’ll want to get this done fast? Just enter your old and new prefix into the boxes below, copy the SQL snippet and apply it to your database. Done.
You, sir, are officially my hero. Thank you for this!
Very nice! You saved me time researching the issue by combing my database and then saved me even more time with your clever little Javascript. Cheers!
Pingback: How to Move a WordPress Site | WordPress Development | CraniumStorm
Its very nice blog.
I have google things but did not find any such a perfect solution of this problem.
but this is perfect one. great job Schenk!!
Thanks.
Solved my issue in less than 30 seconds and I don’t know SQL from a hole in the ground. Thanks!
Thanks for this, but what file do I apply that code snippet to exactly? I accessed my sql info in my cpanel and I have accessed my wordpress files via ftp, yet I am clueless as to where I should be adding this code. Thanks.
Hi Derek,
this code is an SQL statement and you should execute it in your MySQL database used by WordPress via phpMyAdmin or similar. It isn’t meant to be added to a certain PHP file within WordPress but simply executed on the database.