In Drupal 6.x and below, user password was stored in the users table in an md5 hash. So, all one needed to change the password in the database, was to generate the
md5('new password here');
and update the user password field. Now, in Drupal 7, the md5 algorithm was replaced by a more sophisticated 128-bit hashing procedure. It is no longer recommended to brute-force the password into the database, but to load and update the user object.
$account = user_load($uid);
$edit = array();
$edit['pass'] = 'Password goes here';