How to Change your WordPress Username, Nickname and Display Name in MySQL

Change your WordPress UsernameAfter you create an account log in WordPress, you may want to change your WordPress username, as appropriate or due to security reason. However, you can not do this from the WordPress administration console.

Change your WordPress Username

Instead, there is an easier way but rather advance for non-technical people. You can actually use phpMyAdmin to change the username manually in WordPress MySQL database or using the command line or SQL statement as below for your reference.

Change your WordPress Username, Nickname and Display Name in MySQL Table

To do this, follow these steps:

See also  How to Install Varnish 4 on CentOS 6 / CentOS 7

1. Login to your Linux VPS using root or for (share hosting), login to ssh console with your cpanel username.

2. In below example, the wordporess database is wordpressdb and table is wp_users.

# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 62547
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use wordpressdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

3. Print existing “user_login, user_nicename, display_name” in wp_users table.

MariaDB [wordpressdb]> select user_login, user_nicename, display_name from wp_users;
+------------+---------------+--------------+
| user_login | user_nicename | display_name |
+------------+---------------+--------------+
| admin      | admin         | admin        |
+------------+---------------+--------------+
1 row in set (0.00 sec)

4. Update “user_login, user_nicename, display_name” in wp_users table to new prefered username, nickname and display name.

MariaDB [wordpressdb]> update wp_users SET user_login = 'problogger';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MariaDB [wordpressdb]> update wp_users SET user_nicename = 'problogger';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MariaDB [wordpressdb]> update wp_users SET display_name = 'problogger';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

5. Print updated “user_login, user_nicename, display_name” in wp_users table.

MariaDB [wordpressdb]> select user_login, user_nicename, display_name from wp_users;
+------------+---------------+--------------+
| user_login | user_nicename | display_name |
+------------+---------------+--------------+
| problogger | problogger    | problogger   |
+------------+---------------+--------------+
1 row in set (0.00 sec)

I hope this article gives you some ideas and essential guidance on how to change your WordPress username, nickname and display name in MySQL table.

Comments

2 Comments

  • Avatar Ann says:

    Hi.
    I install the plugin on the site (WordPress) for registration in Russian(Allow Cyrillic Usernames) and now I need to change in the sql database, in the table wp_users, in the column user_nicename permission to write more characters from by default 50 to 255.
    How to do this?
    Tried, did not work:
    ALTER TABLE wp_users ALTER COLUMN user_nicename varchar(200) NOT NULL -error

    ALTER TABLE `wp_users` CHANGE `user_nicename` `user_nicename` VARCHAR(255) NOT NULL DEFAULT ”; -error #1067
    Found in net tip:
    show variables like ‘sql_mode’ ;
    And remove the sql_mode “NO_ZERO_IN_DATE,NO_ZERO_DATE” to make it work.
    How to do this one?

  • Avatar Barry Brunning says:

    The user’s Nickname is not user_nicename in the database. Nickname is actually a wp_usermeta field. If one makes a change to user_nicename it’s defeating a WordPress intention. Please see https://wordpress.stackexchange.com/questions/127905/user-login-vs-user-nicename.

Leave a Reply

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