Create a New Admin User via PhpMyAdmin?
Created 5 years ago by envoi

Hey community,

I'm looking to help a client recover access to their admin area through their webhost. I'm trying to regenerate a user account through PhpMyAdmin — with no luck. Any suggestions?

Thanks!

ryanthompson  —  5 years ago

I would say yes except the password hashing. Laravel password hashing is PHP based and I don't know that it can be done with MySQL. However if it can be done it's just an INSERT into users_users and anything else you want (roles pivot information for example).

envoi  —  5 years ago

Unless I did something wrong with the tables, attempting to change or add user information via MySQL didn't work for me. I do not typically use Laravel — just trying to recover some info for a client who had used it so we can move to a different CMS. Any other suggestions are much appreciated!

ryanthompson  —  5 years ago

Can you provide a little more information on what you tried / did? Query string example or something.

One thing is for certain - you can NOT recover a password from database access or any other way. Passwords are one-way hashed.

envoi  —  5 years ago

Thank you for your swift reply. I tried a few things, including changing the email and username and making a copy of the row and changing the password. If there were a way to reset my password via mysite.com/admin, I could get in, but it appears the site doesn't have the functionality for a password reset.

ryanthompson  —  5 years ago

Both /login and /admin/login routes show a "Reset Password" link that points to the built in /users/password/forgot route. You can see an example on this very website: https://pyrocms.com/admin/login and https://pyrocms.com/login which have links to https://pyrocms.com/users/password/forgot

envoi  —  5 years ago

My client's site is somehow missing this function, saying the /users/password/forgot page does not exist. Is there a way to add back that functionality through the site directory? Thank you so much for your help.

ryanthompson  —  5 years ago

What version of Pyro are you on?

fryiee  —  5 years ago

@envoi if you have access to the server, you can run php artisan tinker (may have to composer require laravel/tinker . This will give you a cli shell for the app (assuming we're talking about Pyro 3.x) . You can then run echo bcrypt('your_desired_password'); . This will output a hashed password with the correct salts. You can then take this hash and insert it into the users table via phpMyAdmin (along with username etc), or edit an existing user.