How to Change Your WordPress Admin Username

Hi admin!

Just kidding. That’s not your name is it? Then why keep using it as your WordPress username? Not only is it boring, imagine how easy it is for hackers to guess your admin username.

Well, good news, changing your WordPress admin login username is easy. First, go to your”wp-config.php” file (in the root directory of your WordPress install) and find the name of your WordPress database. It’ll be defined in a line of code that looks like this:

1
2
3
/** The name of the database for WordPress */

define('DB_NAME', 'database_name_here');

Next, go to your Cpanel and look for your PHPMyAdmin icon. It looks like this in most hosting accounts:

Once you’ve clicked that, find your WordPress database and look for the table named “wp_users.” You’ll see your current username under the “user_login” column when you go to the “browse” view for that table. You’re probably the first entry in that table.

Click the “edit” option, change your username to whatever you want (just be sure you remember it) and click save.

Done deal.

Update: Extra Step for Changing Your WordPress Admin Username in Multisite

The above steps work fine for regular WordPress installs, but I forgot to mention that if you have a multisite network which already has  secondary sites, you’ll need to change one more thing in your WordPress multisite database. First, go to your mulsite database and look for the table “wp_sitemeta,” which contains additional information about your network user roles.

Look in the “meta_key” column and find the row which has the record “site_admins.” That same row should have have another column called “meta_value.” In the “meta_value” column you’ll see a record which looks something like this:

a:1:{i:0;s:5:”admin”;}

In your database, the word “admin” will be whatever your OLD admin username was. Simply click “edit,” and change that old username to your new one. So if your username was originally “admin” and you wanted to change it to “baddude,” you would change this…

a:1:{i:0;s:5:”admin”;}

…into this…

a:1:{i:0;s:5:”baddude”;}

Once that’s done, look at the number which comes just before your admin name. In the above example, it’s the number “5,” right there after the “s:” and just before the “:”baddude”; That number represents the number of characters in your admin username, so it needs to be changed to match the number of characters in your NEW admin username.

For example, “admin” has only 5 letters while “baddude” has 7, so the 5 also needs to be changed to a 7 to make this work. So to complete your admin username change, you’d end up changing this…

a:1:{i:0;s:5:”admin”;}

…into this…

a:1:{i:0;s:7:”baddude”;}

Once that’s done, you simply log out of your multisite admin area, log back in and it should be working fine.

Best,

-Seth C

 

 

Comments (8)

  1. Thanks for the email Saana, it appears you’ve already got a few sites running on your multisite network, so there’s one additional step required to make sure your superadmin status remains. I’ve just added it to the post. Thanks for contributing!

  2. Does the first trick work for a site already running and loaded with content?

    Never done it before, so kind of scared if changing username directly in db may cause some troubles!

Participate