To reset the Moodle administrator password, you can follow these steps based on the method that best fits your situation:
1. Reset Password via the Moodle User Interface (if you have access to the admin email)
- Go to the Moodle login page.
- Click on "Forgotten your username or password?".
- Enter the administrator's username or the email address associated with the admin account.
- Moodle will send a password reset link to the admin email address.
2. Reset via the Database (MySQL/PhpMyAdmin method)
If you have access to the database, you can reset the password directly:
Log in to your database using phpMyAdmin or the command line.
For command line:
mysql -u root -p
Select the Moodle database:
USE your_moodle_database_name;
Run the following query to find the administrator user:
SELECT id, username FROM mdl_user WHERE username = 'admin';
Update the password:
UPDATE mdl_user SET password = md5('newpassword') WHERE username = 'admin';
Replace 'newpassword' with your new password, and then click "Go" or run the command.
Logout and log in to Moodle with the updated password.
3. Using the Command Line (CLI) Script
If you have SSH access to the Moodle server, you can use the Moodle command-line tools to reset the password:
Navigate to the Moodle directory:
cd /path/to/moodle
Run the following CLI command to reset the admin password:
php admin/cli/reset_password.php --username=admin
You will be prompted to enter a new password for the admin user.
After resetting the password using any of these methods, you should be able to log in with the new credentials.