Connect to the WordPress database via the phpMyAdmin tool at your web hosting account or open up a MySQL terminal to execute the below MySQL command.
Once in phpMyAdmin select the WordPress database & Open the SQL tab (look at the top navigation bar).
write the following SQL query:
UPDATE `wp_users` SET `user_pass` = MD5( 'new_password_here' ) WHERE `wp_users`.`user_login` = "admin_username";
“new_password_here” – replace this with the new password you wish to use.
“admin_username” – replace this with the username the password should be updated for.
Click on the GO button to submit the query. If everything goes fine without errors, you can login to the site using the new password.
Very useful query, thanks! Just wanted to add that it’s possible to reset password even without phpmyadmin. this takes longer but is useful when you have no phpmyadmin (it happens ;)):
Reset password
but still, I like your code better.. :p