Rails db:create error - PG::ConnectionBad: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: database "_development" does not exist

If when trying to create (or recreate) your dev db with rails db:create you are getting:

PG::ConnectionBad: connection to server on socket “/tmp/.s.PGSQL.5432” failed: FATAL: database “_development” does not exist

Then it might be because you have model dependant logic in an initialiser or your routes.rb file. Commenting out everything in my routes.rb (then uncommenting it afterwards) was a quick and easy way to fix it for me :023:

2 Likes

Corresponding tweet for this thread:

Share link for this tweet.

1 Like