Posted on 九月 26, 2018
解决修改PG端口后psql -U postgres报could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?问题
#修改端口 vi /xxxx/pgsql/10/data/postgresql.conf #修改port = xxx,然后重启pg #发现报标题所示的错误。需修改环境变量增加PGPORT cd ~/ touch .bash_profile vi .bash_profile #增加 PGPORT=xxx export PGPORT #保存后,需继续执行如下命令 source .bash_profile #这样就增加了PGPORT变量,可以echo查看 echo $PGPORT
参考:
https://www.cnblogs.com/space-place/p/5257127.html
https://www.jianshu.com/p/1bc529a4e69c