vendredi 3 février 2023

rails database setup command can not make the database as I wish?

I am newbie with Ruby Rails and here is my problem.

I created a very simple Rails program by this command

rails new freelancer --database=postgresql --javascript=webpack

And I had no error

In this file

config -> locales -> database.yml

I saw 2 files

database: freelancer_test database: freelancer_development

Then I ran this command

rails db:setup

It showed me this error

Is the server running locally and accepting connections on that socket? Couldn't create 'freelancer_development' database. Please check your configuration. rails aborted! ActiveRecord::ConnectionNotEstablished: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? Caused by: PG::ConnectionBad: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? Tasks: TOP => db:setup => db:create (See full trace by running task with --trace)

I thought that it must created 2 databases freelancer_test and freelancer_development ?

Could you please give me some advices ? Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire