1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| [postgres@server ~]$ psql -h 127.0.0.1 -U admin -p 5432 -d mydb psql: could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?
(1)确认postgre服务正常运行 [postgres@server ~]$ ps -ef|grep -v grep|grep postgres: postgres 5195 5193 0 11:20 ? 00:00:00 postgres: checkpointer process postgres 5196 5193 0 11:20 ? 00:00:00 postgres: writer process postgres 5197 5193 0 11:20 ? 00:00:00 postgres: wal writer process postgres 5198 5193 0 11:20 ? 00:00:00 postgres: autovacuum launcher process postgres 5199 5193 0 11:20 ? 00:00:00 postgres: archiver process postgres 5200 5193 0 11:20 ? 00:00:00 postgres: stats collector process postgres 5201 5193 0 11:20 ? 00:00:00 postgres: bgworker: logical replication launcher
(2)修改postgresql.conf配置文件 [postgres@server ~]$ vi $PGDATA/postgresql.conf listen_addresses = '192.168.1.136, 127.0.0.1' (4)修改防火墙配置文件,添加以下内容 [postgres@server ~]$ vi $PGDATA/pg_hba.conf host all all 127.0.0.1/32 trust
(5)重启PG [postgres@server ~]$ vi $PGDATA/pg_hba.conf
(6)登录验证 [postgres@server ~]$ psql -h 127.0.0.1 -U admin -p 5432 -d mydb psql (10.12) Type "help" for help.
mydb=>
|