Reset EMQX admin password
I recently forgot the password for the admin dashboard on my EMQX instance running on Home Assistant OS and needed to reset it.
Thankfully EMQX ships a built-in CLI that makes this easy without restarting anything.
First, shell into the running EMQX container. Since addons use a unique ID you can look it up by filtering the running containers:
docker exec -it $(docker ps --format json | jq -r -c 'select( .Names | contains("emqx")).ID') bash
Then reset the password for the default admin user:
/opt/emqx/bin/emqx ctl admins passwd <new-password>
If you don’t know the username to reset, you can create a new one instead:
/opt/emqx/bin/emqx ctl admins add <new-username> <password>
The change takes effect immediately, so verify by signing in to the dashboard with the new credentials.