# Reset Mattermost

**URL:** <https://forum.mattermost.com/t/reset-mattermost/8969>\
**Category:** Troubleshooting\
**Created:** [February 11, 2020, 8:56pm UTC](https://forum.mattermost.com/t/reset-mattermost/8969 "2020-02-11T20:56:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daansk44](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/daansk44/32/3512_2.png) [@daansk44](https://forum.mattermost.com/u/daansk44)\
**Post date:** [February 11, 2020, 8:56pm UTC](https://forum.mattermost.com/t/reset-mattermost/8969/1 "2020-02-11T20:56:03Z")

</div>

For feature requests, please see: [Contributing Feature Proposals - Mattermost](http://www.mattermost.org/feature-requests/).

For troubleshooting questions, please post in the following format:

#### Summary

Hey everyone. I locked myself out of mattermost.  
I have setup an mattermost installation on gitlab. But I forgot to save the password from the user (and the username)

#### Steps I took

I have tried to remove the database and reconfigure GitLab (and mattermost), but it fails to remove the database

> [@Resetting Gitlab Omnibus Mattermost installation](https://forum.mattermost.com/t/resetting-gitlab-omnibus-mattermost-installation/464/5):
>
> Here’s what worked for me (use at your own risk): Login to the database sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq\_production Drop mattermost DB drop database mattermost\_production; Exit (\q) and run gitlab-ctl reconfigure The last step will recreate the database

When I do this I get:  
ERROR: database “mattermost\_production” is being accessed by other users  
DETAIL: There are 5 other sessions using the database.

I can’t reset it using mail, since smtp is not yet enabled

---

<div class="post-metadata">

**Author:** ![ahmaddanial](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ahmaddanial/32/2938_2.png) [@ahmaddanial](https://forum.mattermost.com/u/ahmaddanial)\
**Post date:** [February 14, 2020, 12:50am UTC](https://forum.mattermost.com/t/reset-mattermost/8969/2 "2020-02-14T00:50:18Z")

</div>

Hello, @daansk44

Can you please try to revoke the future connections to the database first?

```auto
REVOKE CONNECT ON DATABASE mattermost_production FROM public;

```

Once done, go through the the current connections and can terminate all connections to this database except yours.

```auto
SELECT pid, pg_terminate_backend(pid) 
FROM pg_stat_activity 
WHERE datname = current_database() AND pid <> pg_backend_pid();

```

You should then be able to drop the database. Let me know how it goes on your end.
