How to change administrator username in WordPress

By default, WordPress won’t allow you to change username of  your administrator account. There are several ways to do this. There are even plugins for this, but I think using plugins for this task is unnecessary and bad idea in general. WordPress is great but consider using as less plugins as you can. Especially bad ones, they are just calling to be hacked by evil guys with too much time. 🙂

Here is how to change administrators username with one simple mysql command.

First, select your wordpress database.

mysql> show tables;
+-----------------------+
| Tables_in_sample-blog |
+-----------------------+
| wp_commentmeta        |
| wp_comments           |
| wp_links              |
| wp_options            |
| wp_postmeta           |
| wp_posts              |
| wp_snippets           |
| wp_term_relationships |
| wp_term_taxonomy      |
| wp_termmeta           |
| wp_terms              |
| wp_usermeta           |
| wp_users              |
+-----------------------+

So in this case I want to change username for my admin user.

mysql> select id, user_login from wp_users;
+----+------------+
| id | user_login |
+----+------------+
|  1 | admin      |
|  2 | someuser   |
+----+------------+

You just have to update user_login field in wp_users table with command below. Of course change id and user_login value to your needs.

mysql> update wp_users set user_login="igor" where id="1";
Query OK, 1 row affected (0.05 sec)
Rows matched: 1  Changed: 1  Warnings: 0

Username is now changed. You can login in your wordpress with new username.

mysql> select id, user_login from wp_users;
+----+------------+
| id | user_login |
+----+------------+
|  1 | igor       |
|  2 | someuser   |
+----+------------+

Got Something To Say:

Your email address will not be published. Required fields are marked *

*

I accept the Privacy Policy

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 geegkytuts.net
Hosted by SIEL


About author