Regain Admin Access in Moodle: A Step-by-Step Guide

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

      1. Log in to your hosting account or server control panel.

      1. Navigate to PHP MyAdmin. Ensure you have access to your Moodle database.

      1. Select your Moodle database. Look for a prefix like mdl_ or another custom prefix for your tables.

    Step 2: Create a New Admin Account

    Step 2: Create a New Admin Account

        1. In PHP MyAdmin, locate the table named prefix_user (e.g., mdl_user).

        1. Browse the table to view the list of users.

        1. Find the row for the existing admin account (usually ID 2).

        1. Copy this row to create a new admin account:

              1. Use a unique username (e.g., demo_admin).

              1. Set a temporary password (e.g., password3).

              1. Use a valid email address you can access.

          1. 💡 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

            1. Go back to your database and locate the prefix_config table.

            1. Find the siteadmins field.

            1. Edit the field and add the new user’s ID (e.g., 8) alongside the default admin ID (e.g., 2)

          Step 4: Update the Moodle Configuration File

              1. Access your server’s file manager or use FTP to locate your Moodle files.

              1. Open the config.php file (usually found in the public_html folder).

              1. Add or update the following line to include the new admin ID

              1. Copy code
                $CFG->siteadmins = '2,8';

              1. Save the file.

            Step 5: Log in to Your Moodle Site

                1. Visit your Moodle site’s login page.

                1. Use the username and password you created (e.g., demo_admin / password3).

                1. If the login fails, use the Reset Password link to receive a password reset email.

              Step 6: Verify Admin Privileges

                  1. After logging in, navigate to the user list to ensure the new admin account is listed.

                  1. 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.

                    • For added security, remove the changes in config.php once access is restored.

                    • 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

                  Post A Comment