What is your current Ambari version?
A. For Ambari 2.6.2.2 and previous versions, follow these steps in the Ambari host:
1. Log in to Postgres database
# 'psql -U ambari ambari'
2. Enter password for 'ambari' database. Default is 'bigdata'. Can be found in this file:
/etc/ambari-server/conf/password.dat
3. In PSQL run the below query:
update ambari.users set user_password='538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00' where user_name='admin'
4. Quit PSQL
5. Restart Ambari server
ambari-server restart
This will reset the admin account back to the password of 'admin'.
Steps taken from:
https://community.hortonworks.com/questions/449/how-to-reset-ambari-admin-password.html
B. For Ambari 2.7.x you can follow steps mentioned in this article:
[Ambari-2.7.0] How to Reset Ambari Admin Password from Database if you forget it ?
Hope it helps.