This brief tutorial shows you how to easily and quickly change WordPress admin password and email address from its database.
The reason I’m writing this is I ran into a minor issue where I lost control of my admin account.. not due to hackers or someone who deliberately took over my account.
A user who knew and had access to the admin account email requested a password change… the password help email was sent and password reset by the user.
After the change were made, I tried to contact the individual but couldn’t and couldn’t access the admin account.
I resulted to changing the admin account password and email address directly from the database to gain access to the account.
This can be used by anyone with root access to WordPress database.
The first step is to backup your MySQL databases. It’s always important to backup your databases before making changes that may corrupt them.
To backup your MySQL WordPress database, run the commands below, assuming your WordPress database is called wpdatabase.
mysqldump -u root -p wpdatabase >> wpdatabase.sql
After backing up your database, run the commend below to access the database server.
mysql -u root -p
Type the root password and login. When you’re logged into the database server, run the commands below to change the admin user password.
Finally, run the commands below to reset the admin password
UPDATE `wp_users` SET `user_pass` = MD5('new_password_here') WHERE `wp_users`.`user_login` = "admin";
To reset the admin email address from MySQL database, run the commands below
UPDATE `wp_users` SET `user_email` = "new_email_address" WHERE `wp_users`.`user_login` = "admin";
This tip applies to both MySQL and MariaDB database servers. If you run either of these servers, this tip should work.