0
0

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.

[Rails6]ActiveRecord::NoDatabaseErrorの解決法

Last updated at Posted at 2021-03-07

環境はMacBook Airを用いています

エラーの内容

$ rails server

これを実行しサーバーを立ち上げ、 localhost:3000にアクセスすると、
以下のエラーが発生します。

スクリーンショット 2021-03-07 19.17.02.png

解決した方法

結論から言うとデータベースを作るです。
最初にrails newで生成したディレクトリに移動します。

$ cd 移動したいディレクトリ

そして

$ rails db:create

を実行してデータベースを作成してください。
config/database.ymlの内容に合わせてデータベースが自動生成されます

これでまたrails serverを実行すると、、、

$ rails server

スクリーンショット 2021-03-07 19.00.29.png

無事解決!

お!!やったー!!できたー!!
これが皆さんの役に立てれば幸いです!
68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f3939313539382f61643565633933632d323663652d663734392d393965332d3163656436306464326330312e706e67.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?