Change user to admininstrator
To make a user an administrator on a moodle instance, you need to find their UserID and add it to the moodle config table in the database.
Step 1. Get the User ID:
select username,id from mdl_user where username="john";
This will print out something like the following:
+----------+----+
| username | id |
+----------+----+
| john | 4 |
+----------+----+
Step 2. Find out who is/are already administrator/s:
select * from mdl_config where name="siteadmins";
This will print out something like this:
+----+------------+--------------------------------------------------+
| id | name | value |
+----+------------+--------------------------------------------------+
| 23 | siteadmins | 2,289,3497,10187,4164,10165,10175,210,10181,4184 |
+----+------------+--------------------------------------------------+
This means that user ID numbers <2,289,3497,10187,4164,10165,10175,210,10181,4184> are admins
Step 3. Add your user ID to the list.
Copy the list of user ID numbers with commas in them and add yours to the list.
"4,2,289,3497,10187,4164,10165,10175,210,10181,4184"
Step 4. Insert yourself
Issue the following SQL instruction with the new list of user IDs:
update mdl_config set value="4,2,289,3497,10187,4164,10165,10175,210,10181,4184" where name="siteadmins";