Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.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
更改为pg_hba.conf和postgresql.conf以使用pgadmin与所有用户连接后,无法启动postgres服务器_Postgresql - Fatal编程技术网

更改为pg_hba.conf和postgresql.conf以使用pgadmin与所有用户连接后,无法启动postgres服务器

更改为pg_hba.conf和postgresql.conf以使用pgadmin与所有用户连接后,无法启动postgres服务器,postgresql,Postgresql,这就是我在ubantu机器上安装postgresql时遇到的错误。然后在那台机器上,我可以成功地连接它,但只要我切换到下面的文件,允许所有用户连接它。然后我注意到它不会启动 psql:无法连接到服务器:没有这样的文件或目录 服务器是否在本地运行并接受 Unix域套接字上的连接“/var/run/postgresql/.s.PGSQL.5432” 下面您可以看到postgresql.conf # The default values of these variables are driven fr

这就是我在ubantu机器上安装postgresql时遇到的错误。然后在那台机器上,我可以成功地连接它,但只要我切换到下面的文件,允许所有用户连接它。然后我注意到它不会启动

psql:无法连接到服务器:没有这样的文件或目录 服务器是否在本地运行并接受 Unix域套接字上的连接“/var/run/postgresql/.s.PGSQL.5432”

下面您可以看到postgresql.conf

# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/var/lib/postgresql/10/main'          # use data in another directory
                                        # (change requires restart)
hba_file = '/etc/postgresql/10/main/pg_hba.conf'        # host-based authentication file
                                        # (change requires restart)
ident_file = '/etc/postgresql/10/main/pg_ident.conf'    # ident configuration file
                                        # (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/10-main.pid'                   # write an extra PID file
                                        # (change requires restart)


#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
port = 5432                             # (change requires restart)
max_connections = 100                   # (change requires restart)
#superuser_reserved_connections = 3     # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
                                        # (change requires restart)
#unix_socket_group = ''                 # (change requires restart)
#unix_socket_permissions = 0777         # begin with 0 to use octal notation
                                        # (change requires restart)
#bonjour = off                          # advertise server via Bonjour
                                        # (change requires restart)
#bonjour_name = ''                      # defaults to the computer name
                                        # (change requires restart)

# - Security and Authenticatio

n-`

日志文件将告诉您。我已重新安装postgres并将其更改为上述两个文件,以允许所有用户,但仍无法连接到pgAdmin。您能否帮助我退出TCP 0.0.0.0:5432 0.0.0.0:*侦听7020/postgres无法连接到服务器:无法连接到服务器:连接超时(0x0000274C/10060)服务器是否在主机“xx.xx.xx.xx”上运行并在端口5432上接受TCP/IP连接?但是在ubantu上的本地主机上,我可以连接到psql。使用
netstat-anp | grep postgres
查看它是否真的在监听0.0.0:5432,如果是,那么检查防火墙
ufw status verbose
谢谢你的回复,不过我已经在同一端口上检查了它的lisiting,但是我也禁用了防火墙。像鳗鱼一样。还是不知道是怎么回事?
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

data_directory = '/var/lib/postgresql/10/main'          # use data in another directory
                                        # (change requires restart)
hba_file = '/etc/postgresql/10/main/pg_hba.conf'        # host-based authentication file
                                        # (change requires restart)
ident_file = '/etc/postgresql/10/main/pg_ident.conf'    # ident configuration file
                                        # (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
external_pid_file = '/var/run/postgresql/10-main.pid'                   # write an extra PID file
                                        # (change requires restart)


#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
port = 5432                             # (change requires restart)
max_connections = 100                   # (change requires restart)
#superuser_reserved_connections = 3     # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
                                        # (change requires restart)
#unix_socket_group = ''                 # (change requires restart)
#unix_socket_permissions = 0777         # begin with 0 to use octal notation
                                        # (change requires restart)
#bonjour = off                          # advertise server via Bonjour
                                        # (change requires restart)
#bonjour_name = ''                      # defaults to the computer name
                                        # (change requires restart)

# - Security and Authenticatio