Powerful as Directus is among the others, I am very disappointed in its first-time login method.
I have even included the admin user and email in the environment variables, but with no luck.
When accessing Directus through the Portainer console view, it results in software not being installed to execute commands, and maybe because you need to use Directus commands, I guess.
It’s been 3 days that I’ve struggled and now reached out for some help…
On the very first startup, Directus bootstraps the database and creates the initial admin user.
This only happens once — after that, the admin account already exists in the database, and changing the env vars won’t affect it.
Here’s what that means for you:
If you didn’t set ADMIN_EMAIL and ADMIN_PASSWORD before the first run, Directus will still create an admin:
Email:admin@example.com
Password: a random one (printed in the container logs)
If you update the env vars later, they’ll be ignored since the database is already initialized.
If you can access the logs from the very first run, you’ll see the auto-generated admin password there.
Fix options:
Start fresh (if you don’t have important data yet):
In short: make sure ADMIN_EMAIL and ADMIN_PASSWORD are set before the first boot, or check the logs to find the random password Directus generated the first time.
Hey Ahmad I've tried all the above even this : /directus $ npx directus users create \ > --email admin@example.com \ > --password Seigan01@$#% \ > --role 497f7ea1-7c7c-427a-b7c0-b0b076994639 [22:57:30.982] INFO: Extensions loaded 3bd9cfa8-3198-49fb-b080-e873f6cad3d5 But when I log in, it fails And my apologies for the delayed reply in letting you know how it went...
Hey Ahmad I've tried all the above even this : /directus $ npx directus users create \ > --email admin@example.com \ > --password Seigan01@$#% \ > --role 497f7ea1-7c7c-427a-b7c0-b0b076994639 [22:57:30.982] INFO: Extensions loaded 3bd9cfa8-3198-49fb-b080-e873f6cad3d5 But when I log in, it fails And my apologies for the delayed reply in letting you know how it went...
– 7005cbHello, is it not possible for you to delete the DB and recreate it?
– ahmad_quvor