Search code examples
jirahsqldb

Jira recover user and password


Hi I installed JIRA on a ubuntu box, but I forgot to write down my user/password (I know :/).

Mails are not working because the mail server isn't configured, and I can't access the admin panel.

The DB is a hsqldb db and I only have command line which seems impossible to run query's against.

How can I recover my user/password ?


Solution

  • You can run the HSQL Database Manager by shutting down JIRA, then running the following command:

    java -cp /path/to/WEB-INF/lib/hsqldb-1.8.0.5.jar org.hsqldb.util.DatabaseManager \  
         -user sa \
         -url jdbc:hsqldb:/path/to/jira-home/database
    

    ...depending on the actual filename of the HSQL jar. The actual JDBC string should be available in JIRA admin somewhere.

    This will then allow you to look in the cwd_user table for the user and reset the password as described here: https://confluence.atlassian.com/display/JIRA/Retrieving+the+JIRA+Administrator

    You'll be able to see the users with this:

    select u.user_name, d.directory_name 
    from cwd_user u inner join cwd_directory d on u.directory_id = d.id 
    order by directory_name, user_name;
    

    Then reset the password like this:

    update cwd_user 
    set credential='uQieO/1CGMUIXXftw3ynrsaYLShI+GTcPS4LdUGWbIusFvHPfUzD7CZvms6yMMvA8I7FViHVEqr6Mj4pCLKAFQ==' 
    where user_name='some-user-name'; 
    -- new password is 'sphere'
    

    More details on HSQL Database Manager & Atlassian products: