1

I use Hash::make($req->pass); to login in Laravel. Now I forgot the password. Can I change the password by editing PHPMyAdmin? Is there any PHPMyadmin function to change the Bcrypt?

For eg. To change the password stored in MD5, I can change it by using MD5 function. And it works fine for all WordPress logins.

Thanks in Advance

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
  • Does this answer your question? [How to create a laravel hashed password](https://stackoverflow.com/questions/22846897/how-to-create-a-laravel-hashed-password) – Chris Haas Nov 06 '22 at 13:22
  • I already create it, but I want to update a password that is already created using PHPMyAdmin. – ITtraders Nepal Nov 06 '22 at 13:35
  • Yes, that code shows you how to manually run `Hash::make()`, the output of which you can manually enter into the database – Chris Haas Nov 06 '22 at 13:41
  • "_To change the password stored in MD5 ..._" Unrelated info: From PHP's [md5](https://www.php.net/manual/en/function.md5.php) manual: "_Warning It is not recommended to use this function to secure passwords, due to the fast nature of this hashing algorithm. See the [Password Hashing FAQ](https://www.php.net/manual/en/faq.passwords.php#faq.passwords.fasthash) for details and best practices._" – brombeer Nov 06 '22 at 14:06
  • 1
    You can use the artisan console to change the password – Harshana Nov 06 '22 at 14:25

2 Answers2

1

I would use Tinker to achieve this:

php artisan tinker

$user = App/Models/User()::find(/* user_id */);

$user->password = Hash::make('your new password here');

$user->save();

// You should receive a "true" if the update is successful. 
// This can all be done via the command line.

You can also (for the sake of answering your question) just output the password from the route file:

Route::get('generate-password', function () {
  return Hash::make('your new password');
})

visit the '/generate-password' url, copy that password, then paste it into PHPMyAdmin

RShannon
  • 84
  • 4
0

One way to change the password manually is to get the value from

$pw=Hash::make('yourpassword');

to a variable and copy that value into users table password field.

Theekshana
  • 1
  • 1
  • 1