# Unable to reset admin password for Icinga web interface using MySQL

**URL:** <https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087>\
**Category:** Icinga Web\
**Tags:** mysql, icingaweb2\
**Created:** [January 3, 2024, 2:06am UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087 "2024-01-03T02:06:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalaniakahi](https://community.icinga.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@kalaniakahi](https://community.icinga.com/u/kalaniakahi)\
**Post date:** [January 3, 2024, 2:06am UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/1 "2024-01-03T02:06:11Z")

</div>

Following human error in my password manager app, I’m no longer able to login to the administrator account for my Icinga Web 2 interface (lost password). This is also the only Icinga Web user account I have.

Since my web interface uses the _icingaweb2_ database for authentication, I’m trying to reset the admin password directly in MySQL using the following recommendation from [this post](https://community.icinga.com/t/reconfigure-icingaweb2/4744/26):

1. Generated hash for new password:

> openssl passwd -1 -salt 10 i\_want\_this\_as\_password  
> Output:  
> $1$10$dICVmz55eGloV8kHzSm9x.

1. Updated admin user’s password hash in MySQL:

> mysql\> use icingaweb2;  
> mysql\> UPDATE icingaweb\_user SET password\_hash=‘$1$10$dICVmz55eGloV8kHzSm9x.’ WHERE name = ‘my\_admin\_account’;

1. Then ran the following to verify the change:

> mysql\> select \* from icingaweb\_user where name = ‘my\_admin\_account’;

1. Attempted to login to web interface using new password, but received “incorrect username or password” error.

I triple checked that the hash generated by openssl is the same entered in MySQL. Am I missing something?

Thanks.

* * *

- Icinga Web 2 version: **2.9.5**
- Web browser used: **Chrome**
- Icinga 2 version used: **2.13.2-1**
- PHP version used: **7.3.29**
- Server operating system and version: **CentOS 7**

---

<div class="post-metadata">

**Author:** ![nilmerg](https://community.icinga.com/user_avatar/community.icinga.com/nilmerg/32/277_2.png) [@nilmerg](https://community.icinga.com/u/nilmerg)\
**Post date:** [January 8, 2024, 8:32am UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/2 "2024-01-08T08:32:54Z")

</div>

Please hash the password as described in the [documentation](https://icinga.com/docs/icinga-web/latest/doc/20-Advanced-Topics/#manual-user-creation-for-database-authentication-backend). With openssl on the commandline, there’s no guarantee it will work.

---

<div class="post-metadata">

**Author:** ![kalaniakahi](https://community.icinga.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@kalaniakahi](https://community.icinga.com/u/kalaniakahi)\
**Post date:** [January 8, 2024, 11:59pm UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/3 "2024-01-08T23:59:28Z")

</div>

Unfortunately, I previously attempted to hash the new password per the documentation with no luck.

Running `php -r 'echo password_hash("yourtopsecretpassword", PASSWORD_DEFAULT);'` throws an error.

> -bash: php: command not found

I’m running rh-php73-php-fpm v7.3.29

---

<div class="post-metadata">

**Author:** ![homerjay](https://community.icinga.com/user_avatar/community.icinga.com/homerjay/32/377_2.png) [@homerjay](https://community.icinga.com/u/homerjay)\
**Post date:** [January 9, 2024, 9:22am UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/4 "2024-01-09T09:22:40Z")

</div>

Hi.

Just a short note:

Execute the commands on the machine with icingaweb2, php should be installed there.  
Probably, you have to use the full path to php, e.g. : /usr/bin/php

Use:

```auto
type php

```

to get the full path to the php executable.

Greetings,  
Homerjay

---

<div class="post-metadata">

**Author:** ![kalaniakahi](https://community.icinga.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@kalaniakahi](https://community.icinga.com/u/kalaniakahi)\
**Post date:** [January 11, 2024, 7:40pm UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/5 "2024-01-11T19:40:36Z")

</div>

I changed to the directory php is located (usr/bin/php) and tried to run `php -r 'echo password_hash("yourtopsecretpassword", PASSWORD_DEFAULT);' ` but receive the same error.

> -bash: php: command not found

---

<div class="post-metadata">

**Author:** ![homerjay](https://community.icinga.com/user_avatar/community.icinga.com/homerjay/32/377_2.png) [@homerjay](https://community.icinga.com/u/homerjay)\
**Post date:** [January 17, 2024, 9:52am UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/6 "2024-01-17T09:52:03Z")

</div>

> [@kalaniakahi](#):
>
> `php -r 'echo password_hash("yourtopsecretpassword", PASSWORD_DEFAULT);'`

Hi.

Try:

```auto
/usr/bin/php -r 'echo password_hash("yourtopsecretpassword", PASSWORD_DEFAULT);'

```

Greetings,  
HomerJay

---

<div class="post-metadata">

**Author:** ![gryphon85](https://community.icinga.com/user_avatar/community.icinga.com/gryphon85/32/7119_2.png) [@gryphon85](https://community.icinga.com/u/gryphon85)\
**Post date:** [January 17, 2024, 10:35am UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/7 "2024-01-17T10:35:01Z")

</div>

I searched my notes and found an entry where I tried the same.

Here I only used `openssl passwd -1 "geheimespasswort"` without the `-salt 10` attribute.

If you can’t change the password of your icinga web administrator you can create a new user:

```auto
INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('icingaadmin', 1, '<hash>');

```

---

<div class="post-metadata">

**Author:** ![kalaniakahi](https://community.icinga.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@kalaniakahi](https://community.icinga.com/u/kalaniakahi)\
**Post date:** [January 17, 2024, 7:34pm UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/8 "2024-01-17T19:34:34Z")

</div>

Running `/usr/bin/php -r 'echo password_hash("yourtopsecretpassword", PASSWORD_DEFAULT);'` results in

> -bash: usr/bin/php: Is a directory

---

<div class="post-metadata">

**Author:** ![kalaniakahi](https://community.icinga.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@kalaniakahi](https://community.icinga.com/u/kalaniakahi)\
**Post date:** [January 17, 2024, 7:54pm UTC](https://community.icinga.com/t/unable-to-reset-admin-password-for-icinga-web-interface-using-mysql/13087/9 "2024-01-17T19:54:49Z")

</div>

Creating a new user and giving them admin privileges was the only thing that worked. Thanks!
