If you are new to postgres database, you might face following error while logging in to the psql.
Error: psql: FATAL: database "root" does not exist
CAUSE:
A database named ‘root’ does not exist on your system
This error trips up new PostgreSQL users quite often. When you simply run psql
from the command line it, by default, attempts to log you into a database with the same name as your current Unix user name. In this case that is ‘root’, but it could be ‘postgres’, or ‘bob’.
SOLUTION
If you are setting up your database for the first time, you will need to become the PostgreSQL user ( typically ‘postgres’ ) which can be accomplished by either:
- logging in as that user
su
‘ing to root and as rootsu
‘ing to the postgres user
Once you are the postgres user you will need to setup one or more databases and some users. See the following articles for more information on this: