How to Change Your WordPress Admin Username

One of the simplest ways to help protect your site from would-be hackers is to choose a custom name for your WordPress admin or super admin account.

Hackers will have a difficult time injecting their way into your account with post requests to your wp-login.php page if they can’t guess your username. This creates an extra step for them since they won’t just have to guess your password.

What if you didn’t change your admin username when you originally created your site or network? In this Weekend WordPress Project I’ll show you how to change your default username for both single and Multisite installs through making a small change to your database.

"Admin" has been entered into the username field in the login form on the wp-login.php page.
The more difficult you can make it for hackers to infiltrate your site, the safer your site will be. Changing your default username is one of many great ways to make your site a little safer.

Finding Your Database Name

Since we need to make slight changes to your database, you will need to know what it’s called in order to figure out which one to edit. You can do this by checking your wp-config.php file in the root of your WordPress files.

In cPanel, select the File Manager button under the Files section. If the File Manager Directory Selection pop-up appears, select the Web Root option or the Document Root for your site in the drop down list.

Select the wp-config.php file and click the Edit button at the top of the page. Look for the code similar to the example below:

Your database name will be listed on line three of this example where your_db is written. Once you know your database’s name you can go ahead and change its tables.

Single WordPress Installations

In cPanel, click the phpMyAdmin button under Databases on the homepage. Select your database from the list on the left. Next, locate the wp_users table.

The "wp_users" table is highlighted in the list of tables for the selected database.
This is the only table you will need to edit for single installs of WordPress.

Click on it and find your admin username on the list.

The "Edit" button is highlighted on the line which displays the admin username option in the "wp_users" table.
If you have more than one user on your site this list will be longer and will display all of them.

Click the Edit button to insert values into the table option. Type in a new username in each of the fields where it’s displayed.

The name "admin" is highlighted in three options: "user_login, "user_nickname" and "display_name."

At the very least, you need to edit the user_login field to change your username. If you would like to also change how your name is displayed on your site’s front end, change the display_name field.

The user_nicename field is the slug that will appear in the URL for places like the author archive page. What you enter here should not include spaces.

It’s usually the same as your login username, but in cases where your username doesn’t look so user friendly like “HeartPrintedUnderpants23,” you can choose a different name to appear as the slug.

When you’re done, save the changes you have made.

The table option drop down lists at the bottom of the page are shown above the "Go" and "Reset" buttons.
You can choose a different option in the second drop down list if you like, but make sure the first one is set to “Save.”

At the bottom of the table options, you’ll see a set of drop down boxes. Set the first one to Save and the second to Go back to previous page, then click Go to save your changes.

Once you’ve made these changes, you’re done and you can now use your new custom username to log in. If you’re using Multisite, there are a few more steps you need to complete.

Multisite Installations

To change your super admin username for your network, first complete the steps above. Once you’re done, go back to your database tables list and find the wp_sitemeta table.

The "wp_sitemeta" table is highlighted in the database list for the Multisite.
If you changed your table prefix to something more customized than the default, then the “wp” part of the table will be different.

Click on it to reveal all its table options. When they load, look under the meta_key column for the site_admins row.

The "site_meta" row is highlighted under the "meta_key" column.
The list of table options is a lot longer than this, but the option you need is usually listed toward the top.

Click the Edit button on the left of that row. Next, change the values for your admin username in the meta_value field.

The "Insert" page for the "site_admins" table option is displayed.
You do not need to change any other fields for this table option.

There are two things you need to change. The first is your username. The second is the value for the character count of your username.

In the above example, the default username is shown and you would need to change admin and the number five which is displayed before the name. Since the username has five characters, the number five is listed before it.

This number may be different for you if your username is longer than five characters. The meta_value may also look different if you have other permissions attached to your admin account. If this is the case, just look for the same values among the code.

If you wanted to change your username to “HeartPrintedUnderpants23,” for example, you would change the values to look like this:

Admin has been changed to the new username and the number “five” has been changed to “24” to reflect the number of characters in the new username.

Once you’re happy with your new username, click Go at the bottom to save the changes you made.

Conclusion

If you’ve followed along then you have successfully changed your default username to a custom one by making a few small tweaks to your database.

You have also made it a bit more difficult for hackers to get into your site, but this isn’t the only change you should make to increase the security of your site.

If you would like more ways to make your site or network safer, check out our posts Limit Access to the WordPress Login Page to Specific IP AddressesWordPress Security Essentials: Obscurity Tactics and Backups and WordPress Security Essentials : Building A Layered Defense to name only a few.

You can find even more helpful posts by entering the term “security” into the search box on our blog.

If you would like an alternative that doesn’t require making changes to your database, there is another option. You could create a new user and select administrator permissions for it. Finally, you can delete the original admin user.

Just be aware that some plugins require additional permissions that cannot be selected when you create a new administrator account. That’s why changing your username in your database as we’ve covered in this post is often a better solution.

What is your favorite option for changing your admin username? Did you try changing it? Join the conversation and share your experience in the comments below.