Skip to content

Instantly share code, notes, and snippets.

@tonekk
Created November 20, 2015 12:11
Show Gist options
  • Save tonekk/61864fd640baf8ee60af to your computer and use it in GitHub Desktop.
Save tonekk/61864fd640baf8ee60af to your computer and use it in GitHub Desktop.

Postgres CheatSheet

Create root user

  • Start postgres
  • psql template1
  • CREATE USER root WITH SUPERUSER;

Or

  • sudo -u -i postgres
  • createuser --interactive root

Change root password

  • psql
  • ALTER USER "root" WITH PASSWORD 'new_password';

Create database

root~# createdb db_name

Allow remote connection

  • vim /etc/postgresql/9.3/main/pg_hba.conf
  • Insert line host all all 192.168.101.20/24 trust
  • Change listen in postgresql.conf

http://www.thegeekstuff.com/2014/02/enable-remote-postgresql-connection/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment