局域网访问 虚拟机中Postgresql 拒绝访问
问题:could not connect to server: Permission deniedIs the server running locally and acceptingconnections on Unix domain socket "/tmp/.s.PGSQL.5432"?-------------------------------------------
问题:
could not connect to server: Permission denied
Is the server running locally and acceptingconnections on Unix domain socket "/tmp/.s.PGSQL.5432"?
--------------------------------------------------------
情景描述:
通过127.0.0.1可以访问数据库
Apache发布后不能访问
原因:没有对 /tmp 文件夹访问的权限
--------------------------------------------------------
解决方案:
1)找到 postgres.conf
文件
2) 将listen_addresses = 'localhost'改为listen_addresses = '*'
3) 添加unix socket 文件夹,告诉配置文件
unix_socket_directories = '/var/run/postgresql
, /var/tmp
'
4)修改权限(当前用户)
$ sudo chown root.
ubuntu
/var/tmp
$ sudo chmod g+wx /var/tmp
5)重启postgresql数据库
sudo service postgresql start
更多推荐
所有评论(0)