I had postgresql service running but when I run rake db:create
it abort the rake and throws error
ActiveRecord::NoDatabaseError: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: database “chat_development" does not exist
In my database.yml
I have
development:
<<: *default
database: chat_development
By running the rake command it should create the database but it didn't. I did a lot research and try out the solutions given but nothing work. I did check on this discussion here but when I run rm /usr/local/var/postgres/postmaster.pid
it throws error
rm: /usr/local/var/postgres/postmaster.pid: No such file or directory
If I run command ps auxwww | grep postgres
it will show /opt/homebrew/opt/postgresql/bin/postgres -D /opt/homebrew/var/postgres
If I remember correctly I had issue with the postgres installation when I was getting started (about 4 weeks ago) and did install using Postgres.app, then I had also installed with brew install postgresql
(since I am using mac). I am not sure if there are conflict due to multiple installation.
But just now I uninstalled postgres.app and also ran gem uninstall pg
and re-install using command gem install pg -- --with-pg-config=/usr/local/bin/pg_config
(ref here)
The issue is still there. I don't know what to do anymore. Glad if someone can help. Thank you!