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.
That’s it!
Enjoy!
Frequently Asked Questions
How can I change my WordPress admin password from the database?
To change your WordPress admin password from the database, you can run MySQL commands to update the user_pass field for the admin user in the wp_users table with the new password encrypted using MD5.
What should I do if I lose control of my WordPress admin account?
If you lose control of your WordPress admin account, you can change the admin password and email address directly from the database if you have root access, following proper backup procedures.
Is it possible to reset the WordPress admin email address from the database?
Yes, you can reset the WordPress admin email address from the database by running MySQL commands to update the user_email field for the admin user in the wp_users table with the new email address.
How do I backup my MySQL WordPress database before changing admin credentials?
To backup your MySQL WordPress database, you can use the mysqldump command to create a SQL dump file of your database, ensuring you have a copy of your data before making any changes.
What is the importance of backing up databases before making changes?
Backing up databases before making changes is crucial as it helps prevent data loss or corruption. It allows you to restore your website to a previous state if any issues arise during the process.
Can I change the admin password of my WordPress website without using the dashboard?
Yes, if you have root access to the WordPress database, you can change the admin password directly from the database using MySQL commands, which is helpful when you cannot access the WordPress dashboard.
Are the steps to change WordPress admin password and email address the same for MariaDB?
Yes, the steps to change the WordPress admin password and email address from the database are the same for both MySQL and MariaDB, as they use similar SQL syntax for database operations.
How can I ensure the security of my WordPress admin account after changing the password from the database?
To ensure the security of your WordPress admin account after changing the password from the database, consider enabling two-factor authentication, using strong passwords, and regularly monitoring account activity for any suspicious behavior.