I install postgres version 14 using homebrew.
brew install postgresql
Whenever, I try to run psql command, I get the following error:
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed:
FATAL: database "dev" does not exist
Following are my system paths
/Users/dev/.nvm/versions/node/v15.14.0/bin:
/opt/homebrew/bin:
/opt/homebrew/sbin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/usr/local/MacGPG2/bin:
/Library/Apple/usr/bin:
enter code here
CodePudding user response:
You must be using the 'dev' name in your connection string? Can you show us that? The default db in postgres is called postgres there is no dev database.
When connecting to a fresh install of Postgres entering psql
into the command line actually executes something like
psql -d postgres -U postgres -p 5432 -h localhost
Those are the default values so psql
is fine.
You/your application is entering something like:
psql -d dev -U [user] -p [port] -h [host]
CodePudding user response:
As @VynlJunkie said, your issue is connected with absence of dev
database. There is one more thing you can do. Maybe you want to enter psql
just like this:
> psql
You can do it by creating empty database named dev
. So you enter psql
the way @VynlJunkie explained and run such query:
CREATE DATABASE dev;
Then you could access psql
just using one term in terminal.