debugsqlModerate
psql: fatal database does not exist error
Viewed 0 times
errorfatalexistdatabasepsqldoesnot
Problem
I have a linux user account, postgresql role, and associated database, all called foo.
from the linux user foo, I ran the command
Now when I try to run psql from the linux user foo, I get the error...
So does this mean that when running psql from a linux user account, there must be a database associated with that linux user account?
from the linux user foo, I ran the command
dropdb fooNow when I try to run psql from the linux user foo, I get the error...
psql: FATAL: database "foo" does not existSo does this mean that when running psql from a linux user account, there must be a database associated with that linux user account?
Solution
psql assumes that you want to connect to a database, you can either provide one (just after the command) or it will assume you want to connect to a database whose name is the same as your username (or the account name of the process that started psql):So, you could write:
psql my_dbor
psql -d my_dbor yet
psql --dbname=my_db... and
psql will connect to the (local) database named my_db.You have more connection options that you can check in the documentation.
If you don't have yet a database created, check
createdb.Code Snippets
psql -d my_dbpsql --dbname=my_dbContext
StackExchange Database Administrators Q#176002, answer score: 14
Revisions (0)
No revisions yet.