# Listen on all interfacesĪfter the change, restart postgresql service. Uncomment line 59 and change the Listen address to accept connections within your networks. To enable remote connections, edit PostgreSQL configuration file: sudo nano /etc/postgresql/12/main/nf In ideal production environments, you’ll have a central database server and remote clients connecting to it – But of course within a private network (LAN). Installation of PostgreSQL only accepts connections from localhost. We can create and connect to a database on PostgreSQL server. Other PostgreSQL utilities installed such as createuser and createdb can be used to create database and users. You are now connected to database "mytestdb" as user "postgres". Template1 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres Ĭonnect to database: postgres-# \c mytestdb Template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres Postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 | Mytestdb | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =Tc/postgres Name | Owner | Encoding | Collate | Ctype | Access privileges Postgres=# GRANT ALL PRIVILEGES ON DATABASE mytestdb to mytestuser Postgres=# CREATE USER mytestuser WITH ENCRYPTED PASSWORD 'MyStr0ngPaSS' Let’s create a test database and user to see if it’s working. You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432". Start PostgreSQL prompt by using the command: $ psql psql -c "alter user postgres with password ' StrongAdminPassw0rd'" Let’s reset this user password to a strong Password we can remember. Before you switch to this account, your logged in system user should have sudo privileges. This user has full superadmin access to your entire PostgreSQL instance. May 20 11:49:33 debian systemd: Started PostgreSQL Cluster 12-main.Įnabled Step 4: Test PostgreSQL Connectionĭuring installation, a postgres user is created automatically. May 20 11:49:31 debian systemd: Starting PostgreSQL Cluster 12-main. └─4184 postgres: 12/main: logical replication launcher ├─4183 postgres: 12/main: stats collector ├─4182 postgres: 12/main: autovacuum launcher ├─4180 postgres: 12/main: background writer ├─4177 /usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/12/main -c config_file=/etc/postgresql/12/main/nf Loaded: loaded (/lib/systemd/system/ enabled-runtime vendor preset: enabled)Īctive: active (running) since Fri 11:49:33 UTC 35s agoĬGroup: /system.slice/system-postgresql.slice/ The PostgreSQL service is started and set to come up after every system reboot. Sudo apt -y install postgresql-12 postgresql-client-12Ī successful installation prints a message that is similar to one shared in the next screenshot. Now the repository has been added successfully, update the package list and install PostgreSQL 12 on Debian 10 / Debian 9 Linux system. The GPG key used for signing packages needs to be imported to the system: sudo apt updateĪfter importing GPG key, add PostgreSQL repository: echo "deb `lsb_release -cs`-pgdg main" |sudo tee /etc/apt//pgdg.list Step 3: Install PostgreSQL 12 on Debian 10 / Debian 9
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |