postgresql修改完端口后直接psql连接数据库报错

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/silenceray/article/details/68066514
今天修改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=# 
这样就可以直接进库了

猜你喜欢

转载自blog.csdn.net/silenceray/article/details/68066514
今日推荐