Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

could not connect to database postgres: could not translate host name "p1" to address: Temporary failure in name resolution createuser: could not connect to database postgres: FATAL: no pg_hba.conf entry for host "192.168.2.1", user "postgres", database "postgres", SSL off


could not connect to database postgres: could not translate host name "p1" to address: Temporary failure in name resolution

createuser: could not connect to database postgres: FATAL:  no pg_hba.conf entry for host "192.168.2.1", user "postgres", database "postgres", SSL off
-bash-3.2$ ./createuser -h p1 -p 5432 -D -A -e u7
createuser: could not connect to database postgres: could not translate host name "p1" to address: Temporary failure in name resolution
solution:
step 1:put the entries of host information on host file
-bash-3.2# cat  /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.2.1 p1.postgresql786.com p1
step 2:restart the network adapter
-bash-3.2# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
-bash-3.2# ping p1
PING p1.postgresql786.com (192.168.2.1) 56(84) bytes of data.
64 bytes from p1.postgresql786.com (192.168.2.1): icmp_seq=1 ttl=64 time=1.46 ms
--again run the command 
-bash-3.2$ ./createuser -h p1 -p 5432 -D -A -e u7
createuser: could not connect to database postgres: FATAL: no pg_hba.conf entry for host "192.168.2.1", user "postgres", database "postgres", SSL off
solution :
step1. put the hostname & ip address entries in pg_hba.conf file
-bash-3.2# vi /opt/PostgreSQL/9.3/data/pg_hba.conf
host all all 192.168.2.1/32 md5
:wq
step 2.restart the postgres server 
-bash-3.2# /etc/init.d/postgresql-9.3  restart
Restarting PostgreSQL 9.3:
waiting for server to shut down.... done
server stopped
waiting for server to start.... done
server started
PostgreSQL 9.3 restarted successfully
--Run the command again user will be created succesfully
-bash-3.2$ ./createuser -h p1 -p 5432 -D -A -e u7
Password:
CREATE ROLE u7 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;
--Check the user:
postgres=# \du 
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
nijam | | {}
postgres | Superuser, Create role, Create DB, Replication | {}
rep | Replication +| {}
| 1 connection |
u1 | | {}
u2 | | {}
u3 | Password valid until 2017-06-06 00:00:00-04 | {}
u4 | Create DB | {}
u5 | | {}
u6 | | {}
u7 | | {}
postgres=# select usename,passwd,valuntil,usecreatedb from PG_SHADOW;                          
usename | passwd | valuntil | usecreatedb
----------+-------------------------------------+------------------------+-------------
postgres | md505ea766c2bc9e19f34b66114ace97598 | | t
rep | md5df2c887bcb2c49b903aa33bdbc5c2984 | | f
u1 | | | f
u2 | u2 | | f
u3 | md5dad1ef51b879799793dc38d714b97063 | 2017-06-06 00:00:00-04 | f
nijam | | | f
u4 | md54af10c3137cf79c12265e8d288070711 | | t
u5 | | | f
u6 | | | f
u7 | | | f
(10 rows)

Comments

Popular posts from this blog

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

How to Configuration UDEV SCSI Rules In Oracle Linux 5, 6 and 7

aspell

Linux ctime,mtime,atime,cmin,amin,mmin