i'm using drupal "4.7 beta 4" i don't know what but it seems Drupal has forgot my password from the database and always prompt me with "Sorry. Unrecognized username or password. Have you forgotten your password?" even i'm so sure the password i'm entered is correct.

I've search this forum and i found a way which is changing the password directly from the database by using SQL query. I did it within the "phpmyadmin" and then turn back to the drupal by keyin the corect user id + password again, but still failed with the above prompted message again...

somebody have met with this problem before?


jyang’s picture

I am in the same boat and can not figure it out. Hope someone else will come and shed some lights.

mp78’s picture

I've got the same problem.
I don't have any mail server on my machine so I don't get the mail with the first password. But I can still log in as an Admin (first user) and change the password. I get the message that it is saved (or changed) but when I log out I can't use my new password to log in with. And because I don't get the mail I can't try the first password either. The only way I know is to drop the database and start all over...

mattm’s picture

Same problem with drupal 4.7.2
Tried various patches by people, latest user cvs version, all haven't helped.

mj2308’s picture

hey guys, i had the same problem before and I stupidly deleted my whole site. Afterwards, I found through experimentation that clearing your cache does the trick (it did for me, it may for you). Or you could try logging in with another webbrowser that's never been to ur site or another computer

oemb29’s picture

I have changed millions times and the password dont work. WHAT HAPPEN?

Suerte’s picture

Same problem, drupal 4.7.3, Apache 2.2.3, WinXP, PHP5, MySql 4.1

No luck clearing the cache or using another browser.

marcos.wozniak’s picture

I had tried changing the permissions of ./sites/default/settings.php to read and write before setting administrator's username and password then I restored restrictions, and it has seemed to work fine so far.

Gabriel R.’s picture

OK, I've been banging my head on this problem too, and I just didn't feel like starting from scratch. Not after the painful migration from 4.6 to 4.7, on the way to 5.1,.

The problem with the unrecognized user names after the migration occur for user names that contain Capital Letters. Go into the DB and change the user name to small case, and you're all set.

-- NO, don't read this signature!

Darknesss’s picture

I fixed this issue on our drupal 5.12/mysql 5.0.45 installation in another way. (we had same issue with drupal 5.1)

Not sure if it is the best wat to go but at least it works for us.

use at your own risk ;)

the name column in the users table is of type varbinary.

In modules/user/user.module:
function user_load (somewhere at the start of the file)

there is a foreach:

foreach ($array as $key => $value) {
    if ($key == 'uid' || $key == 'status') {
      $query[] = "$key = %d";
      $params[] = $value;
    else if ($key == 'pass') {
      $query[] = "pass = '%s'";
      $params[] = md5($value);
    else if ($key =='name') {
          $query[]= "LOWER($key) = '%s'";
      $params[] = $value;
    else {
      $query[]= "LOWER($key) = LOWER('%s')";
      $params[] = $value;

The above code is already patched. I added the section

else if ($key =='name') {
          $query[]= "LOWER($key) = '%s'";
      $params[] = $value;

This prevents mysql from doing a case sensitive search on the name (varbinary is case sensitive)