If you’ve lost or need to reset the admin password in Grafana and are using a PostgreSQL database, this guide will show you how to do it quickly and securely.
📌 Prerequisites
Before you begin, make sure you have:
- Access to the PostgreSQL database where Grafana stores credentials.
- Proper permissions to execute SQL commands.
- Grafana running with a PostgreSQL backend.
🔧 Step-by-Step Guide to Reset the Password
1️⃣ Access PostgreSQL
Open a terminal and connect to the PostgreSQL database used by Grafana:
psql -U <your_username> -d <your_database>
Replace <your_username>
with your PostgreSQL user and <your_database>
with the name of the database where Grafana is stored.
2️⃣ Execute the Reset Command
Run the following query to reset the admin user password:
UPDATE public.user
SET password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6',
salt = 'F3FAxVm33R'
WHERE login = 'admin';
This command replaces the admin password with Grafana's default hash for admin
.
3️⃣ Restart Grafana
After running the command, restart the Grafana service to ensure the changes take effect:
sudo systemctl restart grafana-server
Or, if you're using Docker:
docker restart <container_name>
4️⃣ Log In and Change the Password
Now, access Grafana via the web interface (http://your_server:3000
) and log in using:
- Username:
admin
- Password:
admin
Once logged in, Grafana will prompt you to set a new password.
💡 Who am I?
I'm Gabriel Carmo, passionate about technology (especially Open Source). I have experience in Cloud, Kubernetes, OpenShift, Zabbix, Dynatrace and much more! Always exploring new technologies and sharing knowledge. 🚀
📬 Let's connect?
🔗 LinkedIn
🐙 GitHub
🦊 GitLab
🏅 Credly
📧 Contato: contato@gabrielandre.com.br