Changing Admin password using PhpMySql


Is it possible to change the admin password using PhpMySql please?



This category is actually intended for questions regarding the app “Passwords”.

But anyway: You can not reset passwords of any user directly in the database since those passwords are salted.
You can set a new password for the user “admin” from the command line by executing this command: ./occ user:resetpassword admin in the Nextcloud directory.

Thanks for the reply. Sorry I posted this in the wrong section. I couldn’t work out where to post. It is on shared hosting so I can’t run a command at that level. Is it possible if I run something like this:
update oc_users set password=“test123” where uid=“admin”;
Does that password need to be encrypted for it to work please?
Or is it possible to add an email address to the admin and try to recover the password that way please?

As i said, the password of an user can not be changed directly in mysql.
But setting the e-mail address and then using the regular way could work. The userdata is stored in the table accounts.

Thanks for the update. I did set the email address when I first logged in. But now it comes up with:
Couldn’t send reset email. Please contact your administrator.
Is there anyway around this please?

Nextcloud will usually save more information on errors in the nextcloud log. You can find it in the data directory of you Nextcloud installation.
Most probably you can’t send the email because the mail configuration is incorrect. You can change that configuration in the config.php file. See the documentation for the e-mail server.

Well, I had a very bizarre encounter. Whenever, I tried resetting the email via my web browser, it said it couldn’t help me! I opened the app on my Android phone and I was able to reset the password through that. However, when I got in, it said there was an update to NextCloud 14… I pressed go and now cannot get access. It says it is in maintenance mode!

Onward and upwards - thanks for all the help. Just wanted to feedback how it was sorted for anyone else visiting this forum.