【发布时间】:2015-03-09 16:50:00
【问题描述】:
我在本地安装了 postgresql。它没有启动,因为我得到:
psql: 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"?
手动启动它不起作用:
sudo /etc/init.d/postgresql restart
* Restarting PostgreSQL 9.4 database server
* The PostgreSQL server failed to start. Please check the log output:
2015-03-09 17:41:39 CET [3769-1] FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
好的,权限有问题。让我们看看它们:
ls -all /var/run/
drwxr-xr-x 27 root root 900 Mar 9 17:36 .
drwxr-xr-x 25 root root 4096 Feb 28 06:19 ..
drwxrwsr-x 3 postgres-xc postgres-xc 60 Mar 9 17:35 postgresql
我发现了以下内容:执行sudo chmod 777 /var/run/postgresql 解决了问题,之后可以启动 postgresql。不幸的是,这必须在每次重新启动 Ubuntu 后完成。所以两个问题:
1.怎么了?为什么 chmod 不是永久的?
2.如何解决?
谢谢!
【问题讨论】: