How to delete Jira user from database

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible


Problem

It is not possible to delete a user from JIRA because the user is associated with several issues. 

Cause

The user might be a reporter, assignee or commented on several issue so JIRA will not allow you to delete the user until you have removed all the user's associations.

Instead you should make use of the options available in Jira. We have implemented the Right to Erasure. This also contains the option to anonymize users, which should be always the preferred option. When anonymizing users, we’ll change or erase their personal data inJira Core, Jira Software, Jira Service Management, and Advanced Roadmaps for Jira. Please see our documentation on Anonymizing users for these option.

Just removing the user record without removing the associated information can lead to issues, as this will cause records that are pointing to a no longer existing user account.

Workaround

It is possible, but not recommended, to forcefully delete this user from the Database without removing the user from the associated issues

Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

  1. Stop JIRA. Open the database and run the following :

  2. Run this SQL

    select * from cwd_user where user_name = 'xxxxx';
    select * from app_user where lower_user_name in (select lower_user_name from cwd_user where user_name = 'xxxxx');

    Replace xxxxx with the affected username. Case sensitive!

  3. Please take note of the id values of this user in both tables for step 4. The queries might return multiple rows if there are multiple directories with associated with the user, so you might need to take note of multiple ids.

  4. Run this SQL to delete the cwd_user_attributes of the user

    delete from cwd_user_attributes where user_id='xxxxx';

    (info) Replace xxxxx with the id values from step 2

  5. Run this SQL to delete the cwd_membership of the user

    delete from cwd_membership where child_name='xxxxx';

    (info) Replace xxxxx with the affected username


  6. Run this SQL to delete the cwd_user of the user

    delete from cwd_user where user_name ='xxxxx';

    (info) Replace xxxxx with the affected username

  7. Run this SQL to delete the user from app_user

    delete from app_user where id ='xxxxx';

    (info) Replace xxxxx with the id from step 2 that you got for the app_user table


  8. Start JIRA

This will remove the username from all 4 tables :

  • cwd_user_attributes
  • cwd_user
  • cwd_membership
  • app_user


And therefore , removing the user completely from the JIRA Internal Directory. Please remember to restart JIRA after performing the changes from the database
Also note that In some cases, it might need Hard restart of all the nodes as rolling restart may not help.

DescriptionIt is possible, but not recommended, to forcefully delete this user from the Database without removing the user from the associated issues
ProductJira
PlatformServer
Last modified on Jun 26, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.