简体   繁体   中英

In a Laravel app, how can I alter a users password directly in the database?

I'm migrating a Laravel app from one host to another.

I've moved the app to a local environment for testing. In order to test it, I need to log in.

I have usernames but not passwords.

I have no idea what artisan/tinker are, and afaict they are not bundled with the app.

I have control over the environment, including direct access to the database, which is mysql.

How can I change a users password directly in the database?

Create a page name it anything and write this code inside it:

$password = 'hello';
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
echo $hashed_password;

Then run the file and copy this hashed password and insert it in some table row. You can log in with a "hello" password

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM