# Reset admin password via SSH?

**URL:** <https://forum.mautic.org/t/reset-admin-password-via-ssh/10216>\
**Category:** Product Support\
**Created:** [February 8, 2018, 8:32am UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216 "2018-02-08T08:32:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![katalysis](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/katalysis/32/38_2.png) [@katalysis](https://forum.mautic.org/u/katalysis)\
**Post date:** [February 8, 2018, 8:32am UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/1 "2018-02-08T08:32:45Z")

</div>

Is there a way to reset the Mautic admin password via SSH?

The password reset email doe snot seem to send when mailer is set to use sendGrid so I am permanently locked out of Mautic.

---

<div class="post-metadata">

**Author:** ![petertl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/petertl/32/511_2.png) [@petertl](https://forum.mautic.org/u/petertl)\
**Post date:** [February 8, 2018, 10:54am UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/2 "2018-02-08T10:54:36Z")

</div>

You can try to use MySQL client to reset your password.

BUT: You will have to use the proper function (like md5() or sha()) to hash it, otherwise it will not work.

Another BUT: Please don’t empty your password in the database. The Mautic GUI won’t accept an empty value. 🙂

---

<div class="post-metadata">

**Author:** ![petertl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/petertl/32/511_2.png) [@petertl](https://forum.mautic.org/u/petertl)\
**Post date:** [February 8, 2018, 10:58am UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/3 "2018-02-08T10:58:14Z")

</div>

It seems that Mautic uses bcrypt to hash passwords. You will have to bcrypt your new password and write it to the DB.

---

<div class="post-metadata">

**Author:** ![katalysis](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/katalysis/32/38_2.png) [@katalysis](https://forum.mautic.org/u/katalysis)\
**Post date:** [February 8, 2018, 11:31am UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/4 "2018-02-08T11:31:31Z")

</div>

I’m in - thank you PeterTL

---

<div class="post-metadata">

**Author:** ![petertl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/petertl/32/511_2.png) [@petertl](https://forum.mautic.org/u/petertl)\
**Post date:** [February 8, 2018, 12:16pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/5 "2018-02-08T12:16:54Z")

</div>

That’s good to hear!

Would you mind providing a little step-by-step? Maybe the issue happens to someone else - they will be happy to have something at their hands.

---

<div class="post-metadata">

**Author:** ![diegov](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/diegov/32/196_2.png) [@diegov](https://forum.mautic.org/u/diegov)\
**Post date:** [March 5, 2018, 12:55pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/6 "2018-03-05T12:55:24Z")

</div>

One can use the above string to “reset” the password using database (e.g. via PhpMyAdmin).

Put that on the password field in the desired user in the database:

$2a$04$LrQYZmEMFi7GghF0EIv4FOdNv8bFcnlXM9Bta0eb8BWLLlRwcKrUm

Then the user will be able to login using the password “secret” .

Change it after that using the Mautic interface.

---

<div class="post-metadata">

**Author:** ![lawrobrr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lawrobrr/32/570_2.png) [@lawrobrr](https://forum.mautic.org/u/lawrobrr)\
**Post date:** [December 10, 2019, 10:31pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/7 "2019-12-10T22:31:32Z")

</div>

Tried reseting the admin password to “$2a$04$LrQYZmEMFi7GghF0EIv4FOdNv8bFcnlXM9Bta0eb8BWLLlRwcKrUm” and I’m still not able to login.

Is there any way with SSH or Mysql access to reset the Admin Password? Thanks!

---

<div class="post-metadata">

**Author:** ![lawrobrr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lawrobrr/32/570_2.png) [@lawrobrr](https://forum.mautic.org/u/lawrobrr)\
**Post date:** [December 11, 2019, 11:50pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/8 "2019-12-11T23:50:47Z")

</div>

Bump still locked out… can anyone help!! Thanks!

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [December 15, 2019, 1:09pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/9 "2019-12-15T13:09:41Z")

</div>

if you have ssh access to your server you can do the following:

1. Type this command: sudo mysql -u root  
This will log you into mysql,
2. then type: show databases;  
This will show you your databases, usually Mautic default install uses DB name mautic,
3. Type: use mautic; (you can replace the name of the database if you have a different name)
4. Type: select id, username from users;  
This will give you a list of users
5. Type: UPDATE users SET password = “a5b253d8484925a3b4fba260768416dfdcbeaed639bb3435c566cbf54721f846903725c7283cf9ab1f090f179d015f46a50b5e798695547eda6e2342db8918a2” where id = 1; make sure you are using the id of the user you want to update.

now you should be able to login with password 12345678.

Hope that works

---

<div class="post-metadata">

**Author:** ![InsightfulBR](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/insightfulbr/32/244_2.png) [@InsightfulBR](https://forum.mautic.org/u/InsightfulBR)\
**Post date:** [January 15, 2020, 8:20pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/10 "2020-01-15T20:20:53Z")

</div>

Your steps for resetting from phpMyAdmin by changing password and using the password: secret just saved me from a meltdown. Thank You!!

---

<div class="post-metadata">

**Author:** ![dinwal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dinwal/32/2444_2.png) [@dinwal](https://forum.mautic.org/u/dinwal)\
**Post date:** [August 21, 2020, 5:21am UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/11 "2020-08-21T05:21:23Z")

</div>

This isn’t working for me. Tried resetting password from PHPMyAdmin as well as directly using mysql queries. Tried both passwords suggested here but still can’t login.

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [November 5, 2020, 1:19pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/12 "2020-11-05T13:19:33Z")

</div>

Hi and welcome @dinwal

can you take a screenshot of your mysql table of users. I know these are stupid questions, but are you login in with the same user you are changing in the mysql table ?

Another thing to do is maybe go and remove your cache from mautic.  
2.x: /var/www/mautic/app/cache. do rm -rf \*  
3.x:/var/www/mautic/var/cache

---

<div class="post-metadata">

**Author:** ![Yosu\_Cadilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/yosu_cadilla/32/6206_2.png) [@Yosu\_Cadilla](https://forum.mautic.org/u/Yosu_Cadilla)\
**Post date:** [December 17, 2021, 10:12am UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/13 "2021-12-17T10:12:37Z")

</div>

Hi guys,  
Based on the advice posted by @mikew and others, I have created this blog post with the specific steps required to “reset” you master.admin password.

> **[How to Reset Lost Mautic Administrator Password | Mauteam.org](https://mauteam.org/mautic/mautic-admins/reset-lost-mautic-administrator-password/)**
>
> \[SOLVED\] Reset the Mautic password if you cannot login to your Mautic installation anymore, by editing the database from the Linux CMD.

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [December 17, 2021, 11:25am UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/14 "2021-12-17T11:25:11Z")

</div>

@Yosu_Cadilla this is great, would you be willing to contribute it to the Knowledgebase?

---

<div class="post-metadata">

**Author:** ![mybpoconsultant](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mybpoconsultant/32/6161_2.png) [@mybpoconsultant](https://forum.mautic.org/u/mybpoconsultant)\
**Post date:** [July 21, 2024, 5:13pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/15 "2024-07-21T17:13:07Z")

</div>

Found a super easy solution if you do not have access to terminal but PHP Admin through Plesk Gui or similar. So if you are in Plesk/Cpanel for example, what you are going to do is click on the PHP Admin of your Database. Once you are in there follow these steps

1. Search for “users” - You will see a database that should come up with your Mautic Users. Click on the Admin User
2. You will see a field called password. Delete whatever is there (save it somewhere just in case) and replace it with $2y$13$VkE7UjFetqAM13oT4v/VYOfRCGrJ4hbr0zuwRZo6KVfDnNb16WFwy
3. Press on the “Go” button on the bottom right, this is like pressing the save/execute button.
4. You should now be able to login with the username and password as madmin

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/f/ffd842acb1d382e03a81354878b69be94d2b30a3.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/8/82e6da4bf301f31b3c1b80380dd7451d486063e6.png)

---

<div class="post-metadata">

**Author:** ![mybpoconsultant](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mybpoconsultant/32/6161_2.png) [@mybpoconsultant](https://forum.mautic.org/u/mybpoconsultant)\
**Post date:** [July 21, 2024, 5:18pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/16 "2024-07-21T17:18:47Z")

</div>

PS I should also state that this worked for me with Mautic Version 4.4.12 through a web install not docker, save your old password before you try!

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [July 21, 2024, 6:22pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/17 "2024-07-21T18:22:10Z")

</div>

I implemented a command in custom plugin that enables you to reset password.

Plugin is for M5.

---

<div class="post-metadata">

**Author:** ![sfahrenkrog1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/sfahrenkrog1/32/4583_2.png) [@sfahrenkrog1](https://forum.mautic.org/u/sfahrenkrog1)\
**Post date:** [July 22, 2024, 3:41pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/18 "2024-07-22T15:41:59Z")

</div>

Hello

You can reset any mautic password via the ssh shell using the console commands with just one line.

Show a list of mautic users:

```auto
php bin/console doctrine:query:sql "select email from users;"

```

Reset a mautic user via email and set a random generated password:  
(Copy and paste this line into the ssh shell but changing the email address of course)

```auto
EMAIL="admin@localhost.local" CLIENTPWD=$(openssl rand -hex 8) MAUTIC_ENCODED_PWD=$(php bin/console security:encode-password --no-interaction --ansi "$CLIENTPWD"|grep 'Encoded password'|awk '{ print $5; }') && php bin/console doctrine:query:sql "UPDATE users SET password='$MAUTIC_ENCODED_PWD' where email = '$EMAIL'" && echo "'$EMAIL' got new Password: $CLIENTPWD"

```

**Output:**

 ![Bildschirmfoto 2024-07-22 um 18.39.50](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/c/caa4ffc662f406b7d033dc70312bcfb829ba0c2f.png)

(the last line contains the new Password for the email address)

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 22, 2024, 3:46pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/19 "2024-07-22T15:46:55Z")

</div>

Would be great to have some best practices on the docs / KB if anyone would like to contribute!

> **[How to contribute to the Knowledge Base - Mautic Knowledgebase](https://kb.mautic.org/article/how-to-contribute-to-the-knowledge-base.html)**
>
> Found the Knowledgebase helpful? Why not create an account and write some content!

> **[GitHub - mautic/user-documentation](https://github.com/mautic/user-documentation)**
>
> Contribute to mautic/user-documentation development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![joebordes](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joebordes/32/9430_2.png) [@joebordes](https://forum.mautic.org/u/joebordes)\
**Post date:** [July 24, 2024, 3:40pm UTC](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216/20 "2024-07-24T15:40:19Z")

</div>

I adapted @sfahrenkrog1 command for Mautic 5

```auto
EMAIL="admin@localhost.local" CLIENTPWD=$(openssl rand -hex 8) MAUTIC_ENCODED_PWD=$(php bin/console security:hash-password --no-interaction --ansi "$CLIENTPWD"|grep 'Password hash'|awk '{ print $3; }') && php bin/console doctrine:query:sql "UPDATE users SET password='$MAUTIC_ENCODED_PWD' where email = '$EMAIL'" && echo "'$EMAIL' got new Password: $CLIENTPWD"

```

HTH  
Thanks @sfahrenkrog1 !!

[Next page](https://forum.mautic.org/t/reset-admin-password-via-ssh/10216.md?page=2)
