Running PostgreSQL 9.5 on Ubuntu 16

No Gravatar

This quick guide shows the steps I followed to start using PostgreSQL 9.5 on Ubuntu Desktop 16.

Installing PostgreSQL

sudo apt-get install postgresql

PostgreSQL download page.

Starting using PostgreSQL from the console

1. Create a db user

sudo -u postgres createuser tom -d -P

The -P option to set a password; the -d option for allowing the creation of database for your username ‘tom’. Note that ‘tom’ is your operating system username. That way, you can execute PostgreSQL commands without sudoing.

Vía StackOverFlow

2. Database commands

  1. Create a database: createdb mydb
  2. Drop a database: dropdb mydb
  3. Access a database: psql mydb

3. Graphical admin

Download pgAdmin.