Skip to content

Instantly share code, notes, and snippets.

@kenmazaika
Created November 6, 2018 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenmazaika/07614a1a926351b2cc9f215202524067 to your computer and use it in GitHub Desktop.
Save kenmazaika/07614a1a926351b2cc9f215202524067 to your computer and use it in GitHub Desktop.
sudo mv /var/lib/pgsql9/data/postgresql.conf /var/lib/pgsql9/data/postgresql-old.conf
sudo curl -o /var/lib/pgsql9/data/postgresql.conf https://gist.githubusercontent.com/kenmazaika/7bc24fb5541de023fbc8b942e05a1c5c/raw/faa529be3b46eb036229114c15faffa9acbf43a0/postgresql.conf
sudo mv /var/lib/pgsql9/data/pg_hba.conf /var/lib/pgsql9/data/pg_hba-old.conf
sudo curl -o /var/lib/pgsql9/data/pg_hba.conf https://gist.githubusercontent.com/kenmazaika/75d310aaf1509a8a8f95c28cc7c14202/raw/9a681b510fdaac78fbe3c4aa955a101b9fad6487/pg_hba.conf
sudo /etc/init.d/postgresql start
sudo sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'password';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';"
sudo sudo -u postgres psql -c "DROP DATABASE template1;"
sudo sudo -u postgres psql -c "CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';"
sudo sudo -u postgres psql -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';"
echo "setup complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment