How Do You Enter the PostgreSQL Command Line from the Linux Command Prompt?

Problem scenario
You are using Debian or Ubuntu Linux and you want to enter the PostgreSQL command prompt. What do you do?

Solution
Run these commands:

sudo su postgres
psql

You are done. Optionally you can run these passwords if you want:
postgres=# create user jdoe with password 'goodpassword';
postgres=# create database foobar with OWNER=jdoe;

Leave a comment

Your email address will not be published. Required fields are marked *