Introduction
Metabase does not provide an official option to permanently delete user accounts. When a user is deactivated, Metabase marks the account as inactive and prevents the user from logging in, while preserving the user’s questions, dashboards, models, and other content.
In some administrative or data-retention scenarios, you may need to permanently remove a deactivated user and their associated records from the Metabase application database.
Important: Take a complete backup of the Metabase application database before making any changes.
Prerequisites
Before proceeding, ensure that you have:
- Root or administrative access to the Metabase application database.
- Access to the Metabase application database.
- A valid database backup.
- The email address or user ID of the deactivated user.
- Basic knowledge of SQL.
- The Metabase service stopped before making direct database modifications.
Metabase supports PostgreSQL, MySQL, and MariaDB as application databases, with PostgreSQL recommended for production environments.
Implementation
Step 1: Identify the Metabase Application Database
First, identify which database Metabase is using as its application database.
The application database is different from the databases that Metabase connects to for reporting and analytics. Metabase stores users, questions, dashboards, and application configuration in the application database.
For example, if Metabase is using PostgreSQL:
psql -U metabase -d metabase
Step 2: Take a Database Backup
Before deleting anything, take a complete backup.
pg_dump -U metabase metabase > metabase_backup.sql
Verify that the backup file was created successfully before continuing.
Step 3: Find the Deactivated User
Metabase stores user information in the core_user table in its application database.
For example:
SELECT id, email, first_name, last_name, is_active
FROM core_user
WHERE is_active = false;
To find a specific user:
SELECT id, email, first_name, last_name, is_active
FROM core_user
WHERE email = 'user@example.com';
Example output:
id | email | first_name | last_name | is_active ----+-------------------+------------+-----------+---------- 15 | user@example.com | Test | User | false
Here, the user ID is 15.
Step 4: Confirm the User Is Deactivated
Before deleting the account, make sure the user is actually inactive:
SELECT id, email, is_active
FROM core_user
WHERE id = 15;
You should see:
is_active --------- false
Do not proceed with deleting an active account unless you have a specific, tested procedure for doing so.
Step 5: Check User References
This is the most important step.
A Metabase user may be referenced by other application tables. Deleting only the core_user record can result in constraint violations or leave inconsistent application data. Metabase community guidance specifically warns that users can have references in groups, collections, activity, reports, and other tables.
You should therefore inspect the database schema before deleting the user.
For PostgreSQL, you can inspect foreign-key relationships using:
SELECT
tc.table_name,
kcu.column_name,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM information_schema.table_constraints AS tc
JOIN information_schema.key_column_usage AS kcu
ON tc.constraint_name = kcu.constraint_name
JOIN information_schema.constraint_column_usage AS ccu
ON ccu.constraint_name = tc.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY'
AND ccu.table_name = 'core_user';
This helps identify tables that reference core_user.
Step 6: Check Whether the User Owns Metabase Content
Before deleting the user, check whether the account is associated with important content such as questions, dashboards, collections, subscriptions, or other objects.
For example, you can inspect the schema and identify tables containing user references.
Do not blindly run DELETE statements against tables based on an old Metabase version’s schema. Table relationships can change between Metabase releases.
Instead, first inspect your installed version’s actual schema.
Step 7: Delete the User
If you have confirmed that the user has no remaining dependencies that would prevent deletion, the final deletion would involve removing the corresponding user record from the application database.
For example:
DELETE FROM core_user
WHERE id = 15
AND is_active = false;
Then verify:
SELECT id, email, is_active
FROM core_user
WHERE id = 15;
If the query returns no rows, the user record has been removed from core_user.
However, this does not automatically mean that all related records have been safely removed.
Step 8: Start Metabase and Verify
After completing the database changes, start Metabase again.
For a systemd installation:
systemctl start metabase
Then monitor the logs:
journalctl -u metabase -f
If Metabase is running in Docker:
docker logs -f metabase
Check that Metabase starts normally and that there are no database constraint or application errors.
Conclusion
Metabase does not provide an officially supported mechanism for permanently deleting user accounts. The standard approach is to deactivate the account, which prevents login while preserving the user’s Metabase content.
If permanent deletion is absolutely required, administrators can technically remove records from the Metabase application database, but this should be treated as a high-risk database administration task.
The recommended procedure is:
- Take a complete Metabase application database backup.
- Identify the deactivated user’s ID.
- Check all references to the user.
- Remove dependent records only where appropriate.
- Remove the user record.
- Start Metabase.
- Check the Metabase logs.
- Verify that Metabase is functioning correctly.
Never run a simple DELETE FROM core_user on a production Metabase database without first understanding the relationships in your specific Metabase version. Community guidance has specifically warned that users can have references across multiple application tables.
FAQs
1. Can I permanently delete a Metabase user?
Metabase does not officially support permanent account deletion. The supported operation is deactivation.
2. Where are Metabase users stored?
Metabase stores user account information in its application database. In commonly used Metabase schemas, the primary user table is core_user.
3. Can I simply run this query?
DELETE FROM core_user WHERE id = 15;
It is not recommended to do this without checking dependencies first. Other Metabase tables may reference the user.
4. Why did my DELETE FROM core_user query fail?
The user may be referenced by other Metabase tables through foreign-key constraints. You must identify and handle those dependencies before deleting the user.
5. Should I stop Metabase before modifying its application database?
Yes. Stopping Metabase prevents the application from accessing or modifying the database while you are making direct database changes.
Related Articles
How to List Configured Databases in Metabase Using CLI/API? – Pheonix Solutions
How to Add a Database to Metabase via CLI Using the REST API – Pheonix Solutions
Talk to our experts
Have a technology challenge or looking for the right solution for your business? Our team can help you with cloud, DevOps, development, infrastructure, design, and more. Feel free to reach out to our experts here.