Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 824 Bytes

postgres.md

File metadata and controls

46 lines (33 loc) · 824 Bytes

Initial Setup

The first step is installing PostgreSQL:

# Install Postgres
sudo apt-get update --fix-missing
sudo apt-get install -y postgresql-9.1

Connectivity

You'll probably want to configure Postgres to be available to outside hosts:

sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/9.1/main/postgresql.conf
sudo sed -i "s/127.0.0.1\/32/0.0.0.0\/0/g" /etc/postgresql/9.1/main/pg_hba.conf
sudo service postgresql restart

Performance

To enable output of time it took to run a query in psql run:

\timing

Query Results

To disable pagination of query results run:

\pset pager off

Change Password

ALTER USER yourusername WITH PASSWORD 'yournewpassword';