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
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.
2. Database commands
- Create a database:
createdb mydb
- Drop a database:
dropdb mydb
- Access a database:
psql mydb
3. Graphical admin
Download pgAdmin.