Drupal 6 FAQ: How can I change the password of a Drupal user in the database without using the Drupal UI? That is, how can I change a user's password using a database query (such as the need to change the Drupal User 1 password)?
If you ever want/need to change a Drupal 6 user password in your database using the MySQL command line or a tool like PhpMyAdmin, a SQL query like this will do the trick:
update `users` set `pass` = MD5('NewPasswordHere') where `uid` = 5;
In this case I'm updating the password for the Drupal user whose
5, and I'm making their new password "
I learned about this technique on this Drupal.org article How to change the password of User 1. In my case I didn't need to change the password of User 1, but needed to change the password of a different Drupal user, and due to a combination of events I couldn't do this through the web interface.
In summary, if you ever need to change a Drupal 6 user password in the database from a database tool like PhpMyAdmin, or the MySQL command line, that SQL query should do the trick for you.
Drupal 7 and 8
If you need to change the password for a Drupal 7 user, please see this Drupal.org article, as the process seems different.
For resetting user passwords in Drupal 8, I recommend the Drupal Console project. With it, you can reset a user password using this command while your current directory is inside your Drupal 8 project:
$ drupal user:password:reset
It will prompt you for the user id you want to reset. Note that when you type the password it is currently shown in clear text at the command line.