I am well aware that there are plenty other issues posted similar to this. Unfortunately none have helped. I have installed Grafana on MacOS Sonoma using homebrew. After a horrible guess-and-check process of figuring out where homepath was, I finally found it.
% pwd
/opt/homebrew/opt/grafana/share/grafana
% grafana cli admin reset-admin-password admin
INFO [01-19|10:34:12] Starting Grafana logger=settings version= commit= branch= compiled=1969-12-31T16:00:00-08:00
INFO [01-19|10:34:12] Config loaded from logger=settings file=/opt/homebrew/opt/grafana/share/grafana/conf/defaults.ini
INFO [01-19|10:34:12] Target logger=settings target=[all]
INFO [01-19|10:34:12] Path Home logger=settings path=/opt/homebrew/opt/grafana/share/grafana
INFO [01-19|10:34:12] Path Data logger=settings path=/opt/homebrew/opt/grafana/share/grafana/data
INFO [01-19|10:34:12] Path Logs logger=settings path=/opt/homebrew/opt/grafana/share/grafana/data/log
INFO [01-19|10:34:12] Path Plugins logger=settings path=/opt/homebrew/opt/grafana/share/grafana/data/plugins
INFO [01-19|10:34:12] Path Provisioning logger=settings path=/opt/homebrew/opt/grafana/share/grafana/conf/provisioning
INFO [01-19|10:34:12] App mode production logger=settings
INFO [01-19|10:34:12] Connecting to DB logger=sqlstore dbtype=sqlite3
INFO [01-19|10:34:12] Starting DB migrations logger=migrator
INFO [01-19|10:34:12] migrations completed logger=migrator performed=0 skipped=523 duration=370.25µs
INFO [01-19|10:34:12] Envelope encryption state logger=secrets enabled=true current provider=secretKey.v1
Admin password changed successfully ✔
Unfortunately, this doesn’t seem to have any effect and I don’t even see these messages in the log file.
/opt/homebrew/var/log/grafana/grafana.log
I’ve tried a restart using brew services restart grafana, but still no luck. Has anyone who installed Grafana from homebrew figured this out? Please help!
% /usr/local/opt/grafana/bin/grafana-cli --config /usr/local/etc/grafana/grafana.ini --homepath /usr/local/opt/grafana/share/grafana admin reset-admin-password admin
zsh: no such file or directory: /usr/local/opt/grafana/bin/grafana-cli
Thank you for the reply. I didn’t think this would work, since I’ve installed Grafana with Homebrew. It’s installed in a different directory, but unfortunately I get this classic error:
% ls
grafana grafana-cli grafana-server
% pwd
/opt/homebrew/opt/grafana/bin
% grafana cli admin reset-admin-password admin
Grafana-server Init Failed: Could not find config defaults, make sure homepath command line parameter is set or working directory is homepath
But, the command you sent gave me an idea. I swapped out the paths in that command with MY paths, and the command actually returned successful, BUT it appears the password never actually changed in Grafana.
% /opt/homebrew/opt/grafana/bin/grafana cli --config /opt/homebrew/etc/grafana/grafana.ini --homepath /opt/homebrew/opt/grafana/share/grafana admin reset-admin-password admin
INFO [01-22|20:20:41] Starting Grafana logger=settings version= commit= branch= compiled=1969-12-31T18:00:00-06:00
INFO [01-22|20:20:41] Config loaded from logger=settings file=/opt/homebrew/opt/grafana/share/grafana/conf/defaults.ini
INFO [01-22|20:20:41] Config loaded from logger=settings file=/opt/homebrew/etc/grafana/grafana.ini
INFO [01-22|20:20:41] Target logger=settings target=[all]
INFO [01-22|20:20:41] Path Home logger=settings path=/opt/homebrew/opt/grafana/share/grafana
INFO [01-22|20:20:41] Path Data logger=settings path=/opt/homebrew/opt/grafana/share/grafana/data
INFO [01-22|20:20:41] Path Logs logger=settings path=/opt/homebrew/opt/grafana/share/grafana/data/log
INFO [01-22|20:20:41] Path Plugins logger=settings path=/opt/homebrew/opt/grafana/share/grafana/data/plugins
INFO [01-22|20:20:41] Path Provisioning logger=settings path=/opt/homebrew/opt/grafana/share/grafana/conf/provisioning
INFO [01-22|20:20:41] App mode production logger=settings
INFO [01-22|20:20:41] Connecting to DB logger=sqlstore dbtype=sqlite3
INFO [01-22|20:20:41] Starting DB migrations logger=migrator
INFO [01-22|20:20:41] migrations completed logger=migrator performed=0 skipped=523 duration=370.583µs
INFO [01-22|20:20:41] Envelope encryption state logger=secrets enabled=true current provider=secretKey.v1
Admin password changed successfully ✔
I actually gave up with this and reinstalled Grafana, since I didn’t lose too much data. It was becoming too frustrating. I highly recommend looking into this issue. I actually just created a GitHub issue for tracking purposes.
You’re welcome, and thank you for moving it forward!
I should have saved the old logs… sorry about that. Although, I provided steps to reproduce, which should be fairly simple on any Apple computer. Reproducing the issue should give you all the information needed. I am now using a password manager and hope not to encounter this again. But, I will definitely update the issue if so.
The correct command to update the admin password is the following: /opt/homebrew/opt/grafana/bin/grafana cli --config /opt/homebrew/etc/grafana/grafana.ini --homepath /opt/homebrew/opt/grafana/share/grafana --configOverrides cfg:default.paths.data=/opt/homebrew/var/lib/grafana admin reset-admin-password newpassword12345.
Please note the --configOverrides cfg:default.paths.data=/opt/homebrew/var/lib/grafana part which overrides the default path.