牛刀小试:Sqlite在Ubuntu平台上写入时异常[attempt to write a readonly database]

昨天接到Email,告知系统移植到Ubuntu上测试时,无法正常运行,报异常如下:
SQL error: attempt to write a readonly database

初一判断估计是Ubuntu权限问题,于是果断将数据库文件重新设置:
chmod 777 narrative.db

发觉仍然无法写入,困惑,于是进一步google,发觉问题如下:
There can be several reasons for this error message:
1. Several processes have the database open at the same time (see the FAQ).
2. There is a plugin to compress and encrypt the database. It doesn't allow to modify the DB.
3. 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.

很明显,第三点就是造成问题的根源。对于存放数据库文件的文件夹,一直没有关注它是否有相应的写入权限。
于是顺理成章,type command 如下:
chmod 777 mydata (mydata是放narrative.db的文件夹)

经测试,至此,系统正常运行。 :arrow:
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值