Please check below command which I had run:
C:\Windows\system32>psql -U root
Password for user root:
psql: FATAL: database "root" does not exist
If you don't explicitly specify which database you want to connect to, psql
will use the database with the same name as the database user.
Since you specified database user root
, psql
tries to connect to a database of that name, but the database doesn't exist.
Try specifying an existing database:
psql -U root -d mydb
In case you don't know which database to use, or if you never created a database, you can always use the postgres
database.