[SOLVED] How can I delete teams?

Hi @mablae,

It is possible to manually manipulate the database to remove a team and I’ll show you how below. First though, a warning that any database manipulation is NOT recommended, especially if you have critical data you don’t want to lose.

That said if you’re using MySQL you can remove a team by doing the following:

  1. Login to MySQL with mysql --host=dockerhost --user=mmuser --password=mostest
    i. This might be mysql --host=localhost --user=mmuser --password=mostest if you’re running release bits.
  2. Select the database with use mattermost_test;
    i. The database name might also be mattermost or mattermost_production
  3. Find the team Id with SELECT Id FROM Teams WHERE Name = 'someteamname'; and copy it
  4. Delete the team with DELETE FROM Teams WHERE Id = 'yourteamid';
  5. Delete the users with DELETE FROM Users WHERE TeamId = 'yourteamid';
  6. Delete the sessions with DELETE FROM Sessions WHERE TeamId = 'yourteamid';
  7. (Optional) Delete the channels with DELETE FROM Channels WHERE TeamId = 'yourteamid';
  8. Restart your server to clear the sessions cache.

Doing this might have unintended side effects, so it’s up to you whether or not to do it. The steps for Postgres should be very similar.