psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "45.32.1XX.2XX" and accepting
TCP/IP connections on port 5432?
远程数据库端口已经打开了:
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 11516/postgres
tcp6 0 0 ::1:5432 :::* LISTEN 11516/postgres
网上查说要修改pg_hba.conf,但是我在postgresql根目录找不到这个文件,而且在我另一台我可以连接成功服务器上,也不存在这个文件。
求大神解答!感谢~
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
只修改
pg_hba.conf文件是不够的,还要修改postgresql.conf的listen_addresses配置项可以通过
show data_directory;来找到 postgresql 的 PGDATA你用
mysql -uroot -p - P -h试试能不能远程登录mysqld参考问题linux终端能连接mysql数据库,但是通过php程序连接mysql连不起