Postgresql(pgsql)客户端希望套接字位于与postgrsql server不同的位置
尝试连接到工作站上本地运行的postgres时,我得到:Postgresql(pgsql)客户端希望套接字位于与postgrsql server不同的位置,postgresql,Postgresql,尝试连接到工作站上本地运行的postgres时,我得到: $ sudo -u postgres psql -c "create role ..." could not change directory to "/home/esauer/workspace/cfme" psql: could not connect to server: No such file or directory Is the server running locally and accepting con
$ sudo -u postgres psql -c "create role ..."
could not change directory to "/home/esauer/workspace/cfme"
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"?
我的postgres服务器安装在/var/run/postgresql
中创建套接字
如何让客户端在正确的位置查看?使用psql--help
检查--host
选项
然后,您可以通过在.psqlrc
用户文件中设置它来将其永久化
在您的情况下,请尝试:
psql-h/var/run/postgresql-d您的_数据库
用psql--help检查--host
选项
然后,您可以通过在.psqlrc
用户文件中设置它来将其永久化
在您的情况下,请尝试:
psql-h/var/run/postgresql-d您的_数据库
因此,默认的“主机”值是“本地套接字”,但这并没有告诉我为什么它在/tmp/而不是/var/run中查找该套接字,明白了吗…'psql-h/var/run/postgres’将psql指向本地套接字的正确目录。谢谢/在.psqlrc
中定义主机的语法是什么?(\set HOST/var/run/postgresql
不起作用。)因此,默认的“HOST”值是“local socket”,但这并没有告诉我为什么它在/tmp/而不是/var/run中查找该socketo,明白了吗…'psql-h/var/run/postgres’将psql指向本地套接字的正确目录。谢谢/在.psqlrc
中定义主机的语法是什么?(\set HOST/var/run/postgresql
不起作用。)