Home PostgreSQL psql: FATAL: database “root” does not exist

psql: FATAL: database “root” does not exist


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


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’.


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 root su‘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: