问题描述
如何将 SQLite 数据库从只读更改为读写?
How can I change an SQLite database from read-only to read-write?
当我执行更新语句时,我总是得到:
When I executed the update statement, I always got:
SQL 错误:尝试写入只读数据库
SQLite 文件是文件系统上的可写文件.
The SQLite file is a writeable file on the filesystem.
推荐答案
此错误消息可能有多种原因:
There can be several reasons for this error message:
多个进程同时打开数据库(查看常见问题解答).
有一个插件可以压缩和加密数据库.它不允许修改数据库.
There is a plugin to compress and encrypt the database. It doesn't allow to modify the DB.
最后,另一个常见问题说:请确保包含数据库文件的目录对于执行 CGI 脚本的用户也是可写的."我认为这是因为引擎需要在目录中创建更多文件.
Lastly, another FAQ says: "Make sure that the directory containing the database file is also writable to the user executing the CGI script." I think this is because the engine needs to create more files in the directory.
整个文件系统可能是只读的,例如在崩溃之后.
The whole filesystem might be read only, for example after a crash.
在 Unix 系统上,另一个进程可以替换整个文件.
On Unix systems, another process can replace the whole file.
这篇关于将 SQLite 数据库模式更改为读写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!