LoginSignup
3
3

More than 5 years have passed since last update.

【 ActiveRecord::NoDatabaseError 】が出たら試してみる事!

Posted at

$rails db:createを入力⇒下記のエラー発生

FATAL: role "username" does not exist
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>"username", "password"=>"password", "host"=>"db", "database"=>"db_development"}
rails aborted!
ActiveRecord::NoDatabaseError: FATAL: role "username" does not exist

解決策

1.$ psql -q -c'select * from pg_user' postgres
⇒「username」のロールがあるか確認をする。

2.createuser usernameでロール作成

3.$rails db:create

ポイント

FATAL: role "username" does not exist とは、データーベースにusernameが無いから作成するように教えてくれてるんですね。

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