I have installed phpMyAdmin.

I can see the admin user (uid=1) in each of the two databases

I have reset the password using;

update users_field_data set pass=Password("new_password");

I can see that the pass hash has changed confirming a changed password.

I got to http://mysiteURL/user/login and enter the admin name (shown in users_field_data table) and the new password.

Upon submit I only get the border of the login name field changed to red.

I have cleared the sessions table and removed the cache_entity data for uid=1 with no change in behaviour.

yum list | grep -i php

returns a lot of php packages from version 5.6 to 7.3. I am not sure if this is normal but php seems to work since both websites load and I can use phpMyAdmin and phpinfo() returns php7.2.7

I have checked error logs for each website, nginx, drupal and php with no obvious errors.

Curiously drush cli does not work i.e.

./drush uli

sh: module: line 1: syntax error: unexpected end of file sh: error importing function definition for `BASH_FUNC_module' Drupal\Core\Database\ConnectionNotDefinedException: The specified database [error] connection is not defined: default in /app/jbi2/core/lib/Drupal/Core/Database/Database.php:361

I have now resorted to reviewing the Drupal 7 installation steps.

Thanks in advance for any well informed replies.

  • You need to fix your drush installation for starters, then use drush to set the password with ‘user-password’.
    – Kevin
    Jun 26, 2018 at 11:16
  • Possible duplicate of Cannot login after moving site
    – No Sssweat
    Jun 26, 2018 at 16:28

2 Answers 2


Drupal 7 and 8 do not use a straight md5 password hash. The hash includes a site specific "salt" string that is created with you set up the site. This is in the settings.php file generally.

To use SQL to set a password, you will need to use the password-hash.sh file which is located in the core/scripts directory.

Run this from your web root directory like ./core/scripts/password-hash.sh` newpassword

Use the string created as the value for your password in query with no Password function.


You might try running it in the same directory as your site's settings.php file. With D8, some versions of drush have a hard time finding this unless you run it there or set up an alias for the site.

Older version could find it settings.php based on your location (e.g. in a subdirectory of the site directory or would use the sites/default). But newer Drush versions need more information.


There are some good answers here about why the steps you've used are not working and what you can do to resolve them.

I have another idea about how to get logged in as uid 1:

  1. Get a session on the site, since you mention clearing the sessions table I guess you know what is triggering the generation of a session on your site.
  2. Open a mysql prompt, e.g. in phpMyAdmin
  3. Find the session that corresponds to your browser, you can look at the cookies in your browser and find the sessid that matches the value in the sessions table.
  4. Update the uid for that session to be uid 1
  5. Refresh the browser and you should now be uid 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.