How to reset admin pass?


I am installing yii2 and by mistake I have set a password which I cannot remember, the problem is that in the database it is encrypted, could you please let me know how to set it or if you have the original "admin" encryption.

Thank you,


Did you try the default PasswordReset thingy ? :)


in User model there is function called setPassword()

you can use it to set password.

public function setPassword($password)


        $this->password_hash = Yii::$app->security->generatePasswordHash($password);


Thank you, I will give it a try.


Actually there was something so stupid to do that we did not think about it!!

Just delete the admin user and signup again! :-))

you can create new hash password and replace to past hash password in your database.
note: salt is your email account that you want restore it.
$salt= ‘’;
$pass = crypt(‘00000000’,$salt);