This section assumes command line access to the PostgreSQL server from a terminal window. The server used in this section is running Ubuntu Linux 18.10.
To Log into your user account in the database:
psql -U <postgre username> -d <dbname>
Logging in to root PostgreSQL user account
If you are the database administrator and need access to the root PostgreSQL user account, the method is slightly different.
At the terminal window:
sudo -i -u postgres
Logging into the database cluster and database
Once logged in as postgres, it is possible to log into the PostgreSQL database cluster and connect to your database to make alterations as needed.
- Type “psql” into the terminal
- Type “\connect <databasename>” into the sql prompt