sqlitedatabase-locking

How do I unlock an SQLite database?


When I enter sqlite> DELETE FROM mails WHERE ('id' = 71); SQLite returns:

SQL error: database is locked

How do I unlock the database so this query will work?


Solution

  • In Windows OpenedFilesView can find the process handling the database file. Close that program to unlock the database.

    In Linux and macOS you can do something similar:

    $ fuser development.db
    

    This command will show what process is locking the file:

    \> development.db:    5430
    

    Just kill the process:

    kill -9 5430
    

    And your database will be unlocked.