PostgreSQL Server Configuration: Difference between revisions

From MK Wiki EN
Jump to navigation Jump to search
(Initial creation)
 
m (MkWikiEnSysOp moved page PostgreSQL Configuration to PostgreSQL Server Configuration without leaving a redirect)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Open SQL shell ==
sudo -u postgres psql
== Create database and user ==
create database '''dbname''';
create user '''user''' with encrypted password ''''password'''';
grant all privileges on database '''dbname''' to '''user''';
== Listen on all interfaces ==
== Listen on all interfaces ==


Line 4: Line 14:


  listen_addresses = '*'
  listen_addresses = '*'
== Allow user to connect ==
In /etc/postgresql/''version''/main/pg_hba.conf:
host    all            all            10.0.0.0/8            trust
Replace IP address as needed!


[[Category:PostgreSQL]]
[[Category:PostgreSQL]]
[[Category:Linux]]
[[Category:Linux]]

Latest revision as of 19:03, 5 June 2022

Open SQL shell

sudo -u postgres psql

Create database and user

create database dbname;
create user user with encrypted password 'password';
grant all privileges on database dbname to user;

Listen on all interfaces

In /etc/postgresql/version/main/postgresql.conf:

listen_addresses = '*'

Allow user to connect

In /etc/postgresql/version/main/pg_hba.conf:

host    all             all             10.0.0.0/8            trust

Replace IP address as needed!