SYMPTOM: Created a user in Ranger. User is visible in ranger DB but not visible in Ranger UI
ERROR: Logged into mysql DB and executed below command -
SELECT * FROM ranger.x_user where user_name in ('userA');
==> This shows the user exist in x_user table.
SELECT * FROM ranger.x_portal_user where user_name in ('userA');
==> The user is also present in x_portal_user
ROOT CAUSE: Suspected corruption on Ranger DB sometimes.
RESOLUTION: Executing below command resolved the issue
>INSERT INTO x_portal_user_role VALUES(NULL,'2016-09-09 00:00:00','2016-09-09 00:00:00',1,1,(SELECT id FROM x_portal_user WHERE login_id='XXXX'),'ROLE_USER',1);
Replace XXXX with the login_id of the user ('userA') You can replace 'ROLE_USER' with 'ROLE_SYS_ADMIN' if you want it to be an admin