[kwlug-disc] Dumb MySQL question

Khalid Baheyeldin kb at 2bits.com
Fri Apr 3 14:57:13 EDT 2020


On Fri, Apr 3, 2020 at 2:41 PM Charles M <chaslinux at gmail.com> wrote:

> I have a PHP application that has some users stored in a mysql
> database. I can log into mysql and have permission to change the
> database tables. If the table within the database is called users can
> I just:
>
> INSERT into user (userpass) values ('NewMadeUpPass');
>
> Would this work since MySQL hashes passwords? I'd then log into the
> web app and change the password, hopefully rehashing the new password.


The passwords in Drupal are hashed.

For Drupal 7, use the command line script that generates it:

$ cd /whereever/drupal/is

$ ./scripts/password-hash.sh your-password

Then, you can do:

UPDATE users SET pass = 'hash-from-previous-step' WHERE uid = 123;

If you want to create a new user, then you need to use drush:

$ drush help user-create
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20200403/c6c4ebc3/attachment.htm>


More information about the kwlug-disc mailing list