How to create postgresql user and database with peer authentication
Default peer authentication is configured on pg_hba.conf
I tried on postgresql version 9
RootTerminal#passwd dev11
Login with default postgres user first
RootTerminal#su - postgres
Login to postgres terminal with the following command
-bash-4.2$psql
postgres=#create user dev11 with password '$3curE';
CREATE ROLE
postgres=#create database dev11db;
CREATE DATABASE
postgres=#grant all privileges on database dev11db to dev11;
GRANT
Back to RootTerminal and try login with user dev11 to access its database.
RootTerminal#su - dev11
[dev11@centos7-vm1 ~]$ psql -U dev11 -d dev11db
psql (9.2.24)
Type "help" for help.
dev11db=>
Komentar