5
8

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 3 years have passed since last update.

ActiveRecord::NoDatabaseError: Unknown database 'アプリ名_development' 解決策

Posted at

#RMVC設定中にrails db:migrate出来ない

localhost:3000 に'アイウエオ'と表示させたい為
rails new後にターミナルとVSCodeでRMVC設定を行う。
rails db:migrate コマンドを打ち込んだ後に以下のエラーが発生。

・ActiveRecord::NoDatabaseError: Unknown database 'アプリ名_development'
・Mysql2::Error: Unknown database 'アプリ名_development'

databaseがないですよというエラーでした。

databaseがないのなら作ればいいのではと思い、ターミナルで以下のコマンドを打ち込む。

rails db:create

Created database 'アプリ名_development'
Created database 'アプリ名_test'     

上記の様に表示されればdatabaseが出来たはずなので改めて

rails db:migrate

これで無事migrateできました。

#参考記事(重要)
rake or rails コマンドでdbを扱うときのメモ
https://qiita.com/pugiemonn/items/e237b73025d8db8545bf

5
8
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
5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?