How to recover forgotten admin password SS5

Silverstripe Version: Silverstripe 5

Question: How can I reset my forgotten admin password

I have lost the admin password for my Silverstripe 5 installation and try to recover access.
Setting the environment SS_DEFAULT_ADMIN_USERNAME and SS_DEFAULT_ADMIN_PASSWORD variables in .env doesn’t work.
Adding:

use SilverStripe\Security\Security;
Security::setDefaultAdmin('admin','password');

doesn’t work as there is no setDefaultAdmin method anymore.
Maybe there is some documentation for this use case I didn’t find.

It’s curious that the environment variables aren’t working… that should be a reliable way to do it! Are you certain they’re being set properly?

I must apologise. After I tried it again a day later, the way via the environment variables works without any problems.
Thx and sorry.

2 Likes