Skip to content

Instantly share code, notes, and snippets.

@shelley-dev
Last active January 7, 2020 20:12
Show Gist options
  • Select an option

  • Save shelley-dev/32e9429ba0ff821f72a7240506e202b2 to your computer and use it in GitHub Desktop.

Select an option

Save shelley-dev/32e9429ba0ff821f72a7240506e202b2 to your computer and use it in GitHub Desktop.
Database locked error - When logging on to Grafana

Description

You experience issue when trying to log on to Grafana. You are sure that user name and password are correct, but Grafana will not let you in. This issue might arrise because locks are currently blocking the database.

Fix

Even though there might be other ways of fixing this, one solution I found to be successful was to clone the Grafana database and then copy this database back. This has the effect that the locks blocking access to the database is released and you are able to log back into Grafana.

# if sqlite3 is not installed on computer you will need to install this first
sudo apt install sqlite3
<stop grafana>
# the following instructions creates a copy of your grafana database and resets it back
cd <grafana_dir>/data
sqlite3 grafana.db '.clone grafana-bak.db'
mv grafana.db grafana-old.db
mv grafana-bak.db grafana.db
<start grafana>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment