
28 Nov Regain Admin Access in Moodle: A Step-by-Step Guide
If you’ve lost admin access to your Moodle site and can’t reach the Site Administration panel, don’t panic! Whether you’ve forgotten login details or an unexpected issue locked you out, you can regain admin privileges directly from the back end using PHP MyAdmin. Follow this detailed guide, and you’ll be back in control in no time.
why This Guide Matters
Losing admin access can disrupt your ability to manage and maintain your Moodle site. By creating a new admin account through your database and configuration files, you can restore control without reinstalling or starting from scratch.
Step 1: Access PHP MyAdmin
-
- Log in to your hosting account or server control panel.
-
- Navigate to PHP MyAdmin. Ensure you have access to your Moodle database.
-
- Select your Moodle database. Look for a prefix like
mdl_
or another custom prefix for your tables.
- Select your Moodle database. Look for a prefix like
Step 2: Create a New Admin Account
Step 2: Create a New Admin Account
-
- In PHP MyAdmin, locate the table named
prefix_user
(e.g.,mdl_user
).
- In PHP MyAdmin, locate the table named
-
- Browse the table to view the list of users.
-
- Find the row for the existing admin account (usually ID
2
).
- Find the row for the existing admin account (usually ID
-
- Copy this row to create a new admin account:
-
- Use a unique username (e.g.,
demo_admin
).
- Use a unique username (e.g.,
-
- Set a temporary password (e.g.,
password3
).
- Set a temporary password (e.g.,
-
- Use a valid email address you can access.
-
- Copy this row to create a new admin account:
-
- 💡 Note: The password may not work initially, but you can use the “Reset Password” option later.
Step 3: Add the New User to Site Admins
-
- Go back to your database and locate the
prefix_config
table.
- Go back to your database and locate the
-
- Find the
siteadmins
field.
- Find the
-
- Edit the field and add the new user’s ID (e.g.,
8
) alongside the default admin ID (e.g.,2
)
- Edit the field and add the new user’s ID (e.g.,
Step 4: Update the Moodle Configuration File
-
- Access your server’s file manager or use FTP to locate your Moodle files.
-
- Open the
config.php
file (usually found in thepublic_html
folder).
- Open the
-
- Add or update the following line to include the new admin ID
-
- Copy code
$CFG->siteadmins = '2,8';
- Copy code
-
- Save the file.
Step 5: Log in to Your Moodle Site
-
- Visit your Moodle site’s login page.
-
- Use the username and password you created (e.g.,
demo_admin
/password3
).
- Use the username and password you created (e.g.,
-
- If the login fails, use the Reset Password link to receive a password reset email.
Step 6: Verify Admin Privileges
-
- After logging in, navigate to the user list to ensure the new admin account is listed.
-
- Check the Site Administrators list to confirm the new account has been added.
Important Notes
-
- Changes to
config.php
will override in-platform admin settings.
- Changes to
-
- For added security, remove the changes in
config.php
once access is restored.
- For added security, remove the changes in
-
- Always back up your database before making any modifications.
Watch the Tutorial
Here’s a video walkthrough to complement this guide and help you visualize the process:
With these steps, you’ll regain admin access and ensure smooth management of your Moodle site. Don’t let technical hiccups slow you down—take charge and keep learning! 🚀
#Moodle #EdTech #AdminAccess #HowTo
No Comments