Skip to content

Instantly share code, notes, and snippets.

@jakenotjacob
Created November 5, 2013 19:22
Show Gist options
  • Save jakenotjacob/7324610 to your computer and use it in GitHub Desktop.
Save jakenotjacob/7324610 to your computer and use it in GitHub Desktop.
PostgreSQL
gem install pg
- Postgres interface access through Ruby
su - postgres
(or use: sudo su … then once logged in as root… su postgres to switch to postgres user)
-This will switch to the postgres user for setup
Initialize DB Cluster & give access to postgres user
systemd-tmpfiles --create postgresql.conf
mkdir /var/lib/postgres/data
chown -c -R postgres:postgres /var/lib/postgres
sudo su - postgres -c "initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'"
Create Postgres USER
createuser -s -U postgres --interactive
Change Postgres USER password
psql -U postgres
>This will get you INSIDE the PostgreSQL console, where you will type...
ALTER USER postgres with password 'enterTheNewPasswordHere';
Now, make sure that config/database.yml contains the same USERNAME and PASSWORD that you created for the postgresql user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment