今天修改pg的端口号port改成5435后重启完数据库的时候直接psql进库的时候进不去 [postgres@node2 data]$ psql psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432 这时,进数据库有两种方式 1、psql 后面加上端口号 [postgres@node2 data]$ psql -p 5435 psql (9.6.1) Type "help" for help. postgres=# 2、在环境变量/home/postgres/.bash_profile中加上一句 export PGPORT=5435 然后 [postgres@node2 ~]$ source ~/.bash_profile [postgres@node2 ~]$ psql psql (9.6.1) Type "help" for help. postgres=# 这样就可以直接进库了