Skip to content

Instantly share code, notes, and snippets.

@profOnno
Last active November 18, 2017 22:23
Show Gist options
  • Save profOnno/098f42cf97a2b2a84c6aa532f4b8d4ef to your computer and use it in GitHub Desktop.
Save profOnno/098f42cf97a2b2a84c6aa532f4b8d4ef to your computer and use it in GitHub Desktop.

Postgresql for Alpine

apk update
apk add postgresql

Then change /etc/postgresql/postgresql.conf

listen_addresses = 'localhost' # what IP address(es) to listen on;

to

listen_addresses = '*' # what IP address(es) to listen on;

Change /etc/postgresql/pg_hba.conf by adding line after

host all all 127.0.0.1/32 trust

host all all 0.0.0.0/0 md5

replace the net 0.0.0.0/0 with the trusted nets. You can add more host entries. Also see https://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html

https://www.cyberciti.biz/faq/howto-add-postgresql-user-account/

CREATE DATABASE jerry;
GRANT ALL PRIVILEGES ON DATABASE jerry to tom;
ALTER USER 'tom' WITH PASSWORD 'new_password';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment