Changing the Moodle admin password through PhpMyAdmin

The previous article in the Getting Started with Moodle course explained the process for resetting the Moodle username and password in the Moodle dashboard. In the event the Moodle dashboard is not accessible to do this, the password and username can be reset in the database through PhpMyAdmin.

Using PhpMyAdmin to reset the User Password/Username

  1. Log into phpMyAdmin cPanel hosting will have a database utility called PhpMyAdmin within the cpanel. If the Moodle is installed on a non cPanel hosting, contact the hosting company for information on how to edit your database on the server. For more information on loging into PhpMyAdmin and php web hosting, please see the article on “How do I manage a MySQL database in PHPMyAdmin in my control panel (cpanel)?“.
  2. moodle-password-reset-phpmyadmin-second-page

    In PhpMyAdmin, find the table called mdl_user and select it. Since Moodle has many tables, the mdl_user table may be on the second page. Select the second page.

  3. moodle-password-reset-phpmyadmin-select-mdl_user

    Click the mdl_user table.

  4. moodle-password-reset-phpmyadmin-edit

    After selecting the table, find the table row for the user that is being edited. Click the Edit link with the pencil icon.

  5. moodle-password-reset-phpmyadmin-md5

    There will be a series or characters and numbers in the password field. This is an encrypted password so it cannot be viewed in the database. Replace the encrypted text with the new password for the login. Next, in the drop down menu to the left, select MD5 then click Go. This can also be done for the Email address and the Username. The Email and the Username do not need the MD5 hash.

Now that the basics of the Moodle set up is established, it is time to learn more about how to use Moodle. Please check the next article on How to edit the Front page settings in Moodle.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

6 thoughts on “Changing the Moodle admin password through PhpMyAdmin

  1. If you can run php in CLI (command line interface), you can try Moodle build-in admin/cli/reset_password.php to change password. It is maybe more simple because you don’t need to know what hash algorithm which Moodle used.

  2. Step1: Lookup table mdl_user for a account which store password in it. Maybe like “$2y$10$dG…”.
    Step2: Because it show “$10”, you know it’s Cost Factor (or Rounds) is 10.
    Step3: If you want use “new_pass” as new password, you can use php to get hash value:
    echo password_hash(“new_pass”, PASSWORD_BCRYPT, [‘cost’=>10]);
    or any one online Bcrypt Hash Generator.
    Step4: Save the hash value(string) into password column. Then you can use the new password to login.

Was this article helpful? Join the conversation!

Leap into Savings
Leap Ahead with Limited Time Deals