bulk deleting users from moodle using mysql

Login to mysql, e.g.

mysql -u root -p[password_for_database]

type:

use database mymoodle; [where mymoodle is the name of your moodle database]

Suppose now that you want to delete ALL users except "john" and "admin", you would type:

delete from mymoodle.mdl_users where (username not like "%admin%" and username not like "%john%");

exit;

That's all.

Popular posts from this blog

could not find course/ could not find top level course/ could not find course category

migrating moodle from one server to another

installing moosh to make your life easier