Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql(pgsql)客户端希望套接字位于与postgrsql server不同的位置_Postgresql - Fatal编程技术网

Postgresql(pgsql)客户端希望套接字位于与postgrsql server不同的位置

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

尝试连接到工作站上本地运行的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
    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
不起作用。)