I can't believe it, but I seem to have forgotten my admin password. The email reset does not ever send an email. Can someone walk me through how to reset the password through the php? I am using the eguru theme... Does that change anything. I would so very much appreciate some HELP!!!!!
Thanks in advance!
1. Login to your moodle database and find the user table mdl_user (moodle ver. 3.3)
2. which admin password is stored using php function 'password_hash' so run the following code with your desired password (I have used 'test' as password).
3. copy the password and update the table with copied password.
that's all now login with the password you used in php encryption.
Excelent, this solution works perfectly!
I tried the solution that suggested using password_hash, but that didn't work. I looked at the code that Moodle uses to hash the password, and it seems that the second parameter should be PASSWORD_DEFAULT and not PASSWORD_BCRYPT.
Has anyone else encountered this? Is it a matter of Moodle version? I'm running Moodle 3.3.4
Hmm, generating your own bcrypt or MD5 hash and then updating the user table in the sql database is kind of the long way around. If you're already at a command prompt, a simpler method is to use the script designed for that purpose:
sudo -u apache /usr/bin/php admin/cli/reset_password.php
You may need to change the word apache above to say "www-data" (Ubuntu) or "httpd" (CentOS) or something depending on your server. But basically, this script allows an admin to reset any password...
Hope this helps
Would this work for standalone Moodle? Where should I write this command?