Get a list of Site Administrators

The following SQL will help you see which users are site admins in a MySQL/MariaDB database using the find_in_set function to query the values listed in the mdl_config siteadmins key-value.

select u.* 
from mdl_user u
    find_in_set(, (select value from mdl_config where name = 'siteadmins'))

Note you need to use find_in_set instead of the in operator which doesn’t handle the commas returned to separate each siteadmin’s user ID.

No Comments
Back to top