No Administrator Account for Moodle

It is possible to lose an administrator account on your site, especially when importing users from another system.  I’ve seen this happen a few times and here is a quick remedy.

  1. Log into your database software tool, such as phpmyadmin.
  2. Look in your users table (i.e. moodle_user) and find the user account that should be an administrator, and get the id number of the account that you want to be an administrator.

  1. In moodle, modify your config.php file by adding the following line. Change the ID number to the number of your users and upload it to the system.


That’s it.  Next time you log in with that account you should be an administrator again and you should have access to the Administrator block.