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

ActiveRecord::NoDatabaseError

Last updated at Posted at 2021-07-28

環境

Ruby 3.0.2
Rails 6.1.4

事象

以下を実行するとエラーが表示された。
①新規Railsアプリを作成(rails new)
②サーバーを起動(rails s)
config/database.ymlにMySQLの接続情報を追記
④localhost:3000を開く

ActiveRecord::NoDatabaseError

解決策

以下を実行。

rails db:create

「データベースがないよ」というエラーなので、データベースを作ってあげればOK
サーバーを再起動後にリロードしたら、Railsのデフォルト画面が表示されました:ok_hand:

参考資料

1
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
1
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?