Introduction

You can change the WordPress admin username and password directly from the MySQL database using SSH access.


Prerequisites

  • SSH access to the server
  • MySQL root access
  • Access to the WordPress installation directory

Implementation

Log in to the server and navigate to the website’s public_html folder.

Then execute the following commands:

vi wp-config.php

Check the database name used by WordPress and stop using it: q!

mysql
use “database” (database = name of the database )
show tables;
desc wp_users;
select ID, user_login, user_pass from wp_users;


For changing the username

update wp_users set user_login=’username’ where ID=1;


For changing the password

update wp_users set user_pass=md5(‘password’) where user_login=’username’;


Conclusion

Using MySQL commands, you can directly update the WordPress admin username and password from the database.

Leave a Reply