May 2011

26 May

Sqlite: Database is Locked error and unlocking the database

in drupal, sqlite

On a few occasions, my Drupal sites that use SQLite have gotten into various states where Drupal was locked out with an error that reads something like this:

PDOException: SQLSTATE[HY000]: General error: 5 database is locked

Usually this happens after a server crash of some sort. As I understand it, the issue is that a lock was acquired by the process that died, but the lock was never removed. Unfortunately, I have found no obvious way to find and remove the lock. But there is a way to eliminate all of the locks.