Skip to Content

Change user group from backend

How to change user group of a user from backend via MySQL queries?

User groups can be updated from the backend using MySQL queries instead of utilizing the Ezeelogin GUI.

Follow the steps below to update the user group of a user.

1. Find out the database name and database table prefix using below command.

root@admod:~# cat /usr/local/etc/ezlogin/ez.conf | grep -i "db_name\|db_prefix"

Example :   root@admod:~# cat /usr/local/etc/ezlogin/ez.conf | grep -i "db_name\|db_prefix"
             db_name ezlogin_ujnq
             db_prefix pyvzbw_

2. Run below command to find the usergroup ID and replace database name and database table prefix.

root@admod:~# mysql -u root -p -e "use database name ; select id,name from dbprefix_usergroups;"

Example : root@admod:~# mysql -u root -p -e "use ezlogin_ujnq; select id,name from pyvzbw_usergroups;"
Enter password:
+----+---------+
| id | name    |
+----+---------+
| 1  | Admins  |
| 2  | Dummy   |
| 3  | Develop |
+----+---------+

3. Run below queryrunner command and replace username and usergroup ID to change the usergroup.

root@admod:~# php /usr/local/ezlogin/ez_queryrunner.php "update prefix_users set usergroup_id=1 where username='user_name'"

Example : root@admod:~# php /usr/local/ezlogin/ez_queryrunner.php "update prefix_users set usergroup_id=3 where username='Jimmy'"
            update pyvzbw_users set usergroup_id=4 where username='Jimmy'
            Success

Initially, User Jimmy is part of the 'Admins' user group.

User Jimmy has been changed from the 'Admins' user group to the 'Develop' user group.