Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres CLI error: database "dev" does not exist on trying to run any psql command

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:
like image 285
Rusty Avatar asked Feb 13 '26 20:02

Rusty


1 Answers

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]
like image 165
VynlJunkie Avatar answered Feb 16 '26 22:02

VynlJunkie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!