Reset WordPress password from the database
Learn how to reset your WordPress password from the MySQL command line if you've forgotten your password.
It's easily done, we forget the password for a WordPress account, or get asked by a client to reset it. What happens if you don't have access to the email account for that user? Here's how
You may just want to reset it without having to use the 'forgotten password' link where you then have to log into email accounts and then change it from a randomly generated one. If you have access to the database, there's a simple way to do this. Read on to learn how to reset WordPress password from the database.
Reset WordPress password using a MySQL command
In this example, I am going to assume that you are resetting the main Admin password (usually ID 1). Double check this first, and always use a secure password. Assuming the user ID is 1 and the new password is nUp@ssw0rd
, run:
UPDATE wp_users u SET u.`user_pass` = md5('nUp@ssw0rd') WHERE u.`ID` = 1
WordPress uses a function called md5 which creates the hash for a given input so passwords aren't stored in plaintext. Any comments or questions, sound them below.