2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SQLite3::ReadOnlyException: attempt to write a readonly databaseへの対応

Posted at

rails db:dropを実行したときにエラーがでたため(なんのエラーか忘れた)、
sudo rails db:dropをしてDB削除成功。

その後sudo rails db:createでDBを作成し、
rails db:migrateを行ったところ、下記エラーが発生。

WARNING: Nokogiri was built against LibXML version 2.9.8, but has dynamically loaded 2.9.4
rails aborted!
ActiveRecord::StatementInvalid: SQLite3::ReadOnlyException: attempt to write a readonly database: CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)

ReadOnlyExceptionだって。

権限の問題かと思い調べたら、chownで権限を変更すればよいとの情報が。


けどsudo rails db:createしたのがいけなかったのでは?と思い、
再度DBを削除しsudo抜きのrails db:createおよび
rails db:migrateを実行したところ、うまくmigrateされました。


おわり

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?