Regain Your WordPress Admin Account

So, I decided to get cute and changed my WordPress admin username to a username I wanted via a utility called phpMyAdmin. I went to the wp_users table and made a simple username change to the user_login field. I logged out and logged in back to the WordPress Dashboard. Disaster! I just lost both my WordPress admin and network admins rights. My former admin account has been reduced to a regular plebe. So, this is how a regular WordPress subscriber looks like.

It was a scary five minutes at WordPress land. I’m laughing now, but I wasn’t then. So, I went back to phpMyAdmin and also changed the user_nicename and display_name to the wp_users table hoping that would fix it. No cigar. Panic set in. After a few Google searches, I finally found the solution. Thanks to people who post their solutions online.

What a relief! First, you have to make sure you have the right user_id, especially if you have a multisite blog. Go to your wp_users table and make a mental note of your admin ID. It’s usually an ID of 1.

Next, I went to the wp_usermeta table and changed the wp_capabilities entry to a:1:{s:13:”administrator”;s:1:”1″;}.  The key here is the entry s:13. My account was reset to s:1 for some reason. I temporarily changed it to s:10, but it didn’t work. Setting it to s:13 did the trick. It worked wonderfully.

Now, I’ve regained all the admin rights for each blog that’s on the network, except that I’ve lost the Network Admin. Well, another Google search. Thank you. To make the story short, I also had to edit the wp_sitemeta table. Look for the meta_key and change to a:1:{i:0;s:11:”yournewname”;}. The s:11 is the length of “usernewname” which is 11.

That was the fix. Whew. A close shave. All in all, all is good once again at WordPress land. I am one happy admin. Just a bit on the adventurous side, but otherwise a happy camper. I’m posting this article because, I know some dufus admin in the future will probably do the same thing that I did. It wasn’t all that bad. It was just a little bit disconcerting when you lose all admin rights.

10 Essential Tricks for Linux Admins

Learn 10 essential tricks that can make you into a powerful Linux Admin. You’ll be able to do the following: unmount an unresponsive DVD drive, recover a hosed screen, use Posh, recover the root password, learn SSH backdoor, learn to remote VNC through a SSH tunnel, check your bandwidth, learn command-line scripting and utilities, spy on the console, and finally, randomly collect system information. Details.