MySQL password hash saving issue
marre-86
HOBBYOP

15 days ago

I update MySQL database of my project 'password' column in 'users' table (Laravel project) I insert/edit one of the rows:

$2a$12$0xTHSJg1dCbcFoAw6shJDe9y2Eq10tgfw4KOHZL55dgU9ilMD.rYq

but after saving when I view it - it turns to a2bashxTHSJg1dCbcFoAw6shJDe9y2Eq10tgfw4KOHZL55dgU9ilMD.rYq

In the beginning of the hash it changes

$2a$12$0

to

a2bash

Why??

Solved$10 Bounty

5 Replies

Status changed to Open Railway 15 days ago


pocellion
PRO

15 days ago

UPDATE users SET password = '$2a$12$0xTHSJg1dCbcFoAw6shJDe9y2Eq10tgfw4KOHZL55dgU9ilMD.rYq' WHERE id = {your_user_id};

Can you try this on the users table. you have to click users table.

I think the program interprets the dolar sign as shell variable $2 -> empty.


pocellion

```sql UPDATE users SET password = '$2a$12$0xTHSJg1dCbcFoAw6shJDe9y2Eq10tgfw4KOHZL55dgU9ilMD.rYq' WHERE id = {your_user_id}; ``` Can you try this on the users table. you have to click users table. I think the program interprets the dolar sign as shell variable $2 -> empty.

marre-86
HOBBYOP

15 days ago

Did this, but though "query ran successfully" the result is the same

Attachments


It must be a problem with the dollar sign. Try escaping it using \ . The command would be: UPDATE users SET password = '\$2a\$12\$0xTHSJg1dCbcFoAw6shJDe9y2Eq10tgfw4KOHZL55dgU9ilMD.rYq' WHERE id = 1;


darseen

It must be a problem with the dollar sign. Try escaping it using `\` . The command would be: `UPDATE users SET password = '\$2a\$12\$0xTHSJg1dCbcFoAw6shJDe9y2Eq10tgfw4KOHZL55dgU9ilMD.rYq' WHERE id = 1;`

marre-86
HOBBYOP

15 days ago

No, didn't help. The same result

Yeah, it's because of the dollar sign. It distorts the string only if there's a dollar sign in it.

So what should I do?

The proper way would be to run my seeder, but I don't know how to do it - nothing said about it in Laravel project deploy manual...


marre-86
HOBBYOP

15 days ago

I found the way to correctly run my seeder and bypass this issue


Status changed to Solved Railway 15 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...