How do I unlock a SQLite database?

前端 未结 30 1835
栀梦
栀梦 2020-11-22 15:56
sqlite> DELETE FROM mails WHERE (`id` = 71);
SQL error: database is locked

How do I unlock the database so this will work?

30条回答
  •  甜味超标
    2020-11-22 16:33

    Should be a database's internal problem...
    For me it has been manifested after trying to browse database with "SQLite manager"...
    So, if you can't find another process connect to database and you just can't fix it, just try this radical solution:

    1. Provide to export your tables (You can use "SQLite manager" on Firefox)
    2. If the migration alter your database scheme delete the last failed migration
    3. Rename your "database.sqlite" file
    4. Execute "rake db:migrate" to make a new working database
    5. Provide to give the right permissions to database for table's importing
    6. Import your backed up tables
    7. Write the new migration
    8. Execute it with "rake db:migrate"

提交回复
热议问题