How to delete Jira user from database
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
問題
It is not possible to delete a user from JIRA because the user is associated with several issues.
原因
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 in: Jira 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.
回避策
It is possible, but not recommended, to forcefully delete this user from the Database without removing the user from the associated issues
データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。
Stop JIRA. Open the database and run the following :
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!
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.
Run this SQL to delete the cwd_user_attributes of the user
delete from cwd_user_attributes where user_id='xxxxx';
Replace xxxxx with the id values from step 2
Run this SQL to delete the cwd_membership of the user
delete from cwd_membership where child_name='xxxxx';
Replace xxxxx with the affected username
Run this SQL to delete the cwd_user of the user
delete from cwd_user where user_name ='xxxxx';
Replace xxxxx with the affected username
Run this SQL to delete the user from app_user
delete from app_user where id ='xxxxx';
Replace xxxxx with the id from step 2 that you got for the app_user table
- 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.