How to start PostgreSql

Solution 1:

To start the PostgreSQL database (on Ubuntu Server, no GUI), normally you would use the pg_ctl command. Become the admin user that PostgreSQL was installed with. You probably will need to set the environment variables for PGDATA and PGPORT.

When the database is up, you should see something like this:

# pg_ctl status
pg_ctl: server is running (PID: 23890)

To start the database:

# pg_ctl start

To run psql and supply the parameters:

# psql -d {dbname} -p {pgport} -U {username} -W {password} 

Ignore the # symbols as these are just representing the command line.