postgresql 常见问题

  • bash-4.1$ psql
    psql: 无法联接到服务器: 没有那个文件或目录
    服务器是否在本地运行并且在 Unix 域套接字
    “/var/run/postgresql/.s.PGSQL.5432″上准备接受联接?
    (psql: could not connect to server: 没有那个文件或目录
    Is the server running locally and accepting
    connections on Unix domain socket “/tmp/.s.PGSQL.5432”?)
    问题原因:postgresql service stop
    解决方法:service postgresql-9.6 start
  • psql: could not connect to server: Connection refused
    Is the server running on host “192.168.1.232” and accepting
    TCP/IP connections on port 5432?
解决方法:
#vi postgresql.conf
修改 
#listen_addresses = 'localhost' 
为
listen_addresses = '*' 
  • psql: FATAL: no pg_hba.conf entry for host “192.168.1.223”, user “test”, database “test”, SSL off
解决方法:
#vi pg_hba.conf
添加
local database            user                                       password
host  database            user              0.0.0.0/0           password
host  database            user              ::1/0                  password
  • pg_ctl: directory “/home/postgres/pgdata” is not a database cluster directory
./bin/initdb -D ~/pgdata/
  • ERROR: permission denied for relation #{table_name}
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public  TO #{table_user};
    原文作者:fumenyaolang
    原文地址: https://www.jianshu.com/p/388d9e759ac2
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞