Zum Inhalt

Changing the WordPress MySQL Table Prefix -> locked out of admin dashboard

So there I was. Locked out of my own admin dashboard on this very blog. With just one click of the mouse.
Good thing: I exactly knew what I was doing right before this happened which makes it quite a bit easier to find a remedy…

I installed a cute little plugin called „WordPress Security Scan“. The scan told me nothing I didn’t already knew, except that it really might be time to get away from the default table prefix (wp_) and change it into something unguessable (adospfpafhaspdfsadfaf_ – or something like that). The plugin comes with a neat little tool that does all that MySQL stuff for you with just one click of your mouse…

Well, almost. Afterwards I couldn’t reach my blog anymore. Just a blank page. That could be taken care of pretty easily: my wp_config.php was, of course, not writable. But how should wordpress know that the DB table prefix changed if that file isn’t writable. Right, it couldn’t. So I changed the DB table prefix in there manually. And, bang, my blog was back up and running.

Well, almost. I couldn’t log into the admin dashboard anymore. „You do not have sufficient permissions to access this page.“ Who on earth should have sufficient permissions if not the admin himelf?!
Since this was a problem I ran into out of pure laziness, I figured I should at least try to fix this by myself. A little self-punishment for trusting some little plugin with your database. 🙂

My first (well, actually, second… okay, maybe third…) guess was, that there’s nothing actually wrong with the data inside the database, but there is something in there that still references the old table prefix. After some poking around I indeed find out that this was true for some values in newPrefix_options and newPrefix_usermeta.

So, here’s how to fix this – quick and easy (if you’re having access to your DB server or a tool like phpMyAdmin, that is).

UPDATE newPrefix_options SET option_name = REPLACE (option_name, ‚oldPrefix_‘, ’newPrefix_‘);
UPDATE newPreifix_usermeta SET meta_key = REPLACE(meta_key, ‚oldPrefix_‘, ’newPrefix_‘);

If that doesn’t work for you, something else is wrong. 🙂

Published inAllgemein


  1. Ind Serial Ind Serial

    When I clicked on the pic I was send to a 404 page. So unfortunately no video.

  2. Ind Serial Ind Serial

    When I clicked on the pic I was send to a 404 page. So unfortunately no video.

Kommentar verfassen

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.