I have deleted admin account and locked myself out -- Please help!


Good Evening. Hope you are doing great.

I have integrated LDAP and created a group in LDAP for admin access which was working fine and later deleted default admin group sonar-administrators and when I attempt to log in today my LDAP user is not logging in with Admin privileges. It logged in like a default sonar-users.

Tried so far to achieve this:

I have logged in to the DB switched to the sonar database and executed this query mentioned in the Sonarqube Documentation

INSERT INTO user_roles(user_id, role) VALUES ((select id from users where login='mylogin'), 'admin');

The error I am getting:

ERROR 1364 (HY000): Field 'organization_uuid' doesn't have a default value

NOTE: I have a local created user sonarqube which I replaced with ‘mylogin’

FYI: I am using SonarQube 6.7.6 LTS

MYSQL user_roles table:



Welcome to the community :slight_smile:

The query mentioned in the doc is outdated, as the schema as changed. Here is a query you can use :

INSERT INTO user_roles(user_id, role, organization_uuid) 
VALUES ((select id from users where login='mylogin'), 
(select uuid from organizations where kee='default-organization'));
1 Like

It is working, Thank you very much.

Somebody please update it in the documentation.
appreciate it.

Already did with https://jira.sonarsource.com/browse/SONAR-12595 :slight_smile:

1 Like