Create a New Admin User via PhpMyAdmin?
Created 6 years ago by envoiHey 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!
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!
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.
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.
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
What version of Pyro are you on?
@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.
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
intousers_users
and anything else you want (roles pivot information for example).