Thread: trouble connecting with psql to running server
Hi all-
I can't connect by psql like this:
./psql -h localhost -p 5432 -d template1.
Here is some data:
$ ./psql -h 127.0.0.1 -p 5342 -d template1
psql: error: could not connect to server: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5342?
$ ./postgres -d 3 -D C:/msys64/usr/local/pgsql/data -c config_file=/c:/msys64/usr/local/pgsql/data/postgresql.conf
psql: error: could not connect to server: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5342?
$ ./postgres -d 3 -D C:/msys64/usr/local/pgsql/data -c config_file=/c:/msys64/usr/local/pgsql/data/postgresql.conf
2019-05-07 22:39:19.833 EDT [23160] LOG: starting PostgreSQL 12devel on x86_64-w64-mingw32, compiled by x86_64-w64-mingw32-gcc.exe (Rev2, Built by MSYS2 project) 8.3.0, 64-bit
2019-05-07 22:39:19.838 EDT [23160] LOG: listening on IPv6 address "::1", port 5432
2019-05-07 22:39:19.838 EDT [23160] LOG: listening on IPv4 address "127.0.0.1",
2019-05-07 22:39:19.838 EDT [23160] LOG: listening on IPv6 address "::1", port 5432
2019-05-07 22:39:19.838 EDT [23160] LOG: listening on IPv4 address "127.0.0.1",
It (postmaster) is still going. No idea why I can't connect with psql client.
Here is my pg_hba.conf:
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
Any ideas guys/gals?
I normally don't get this stuck. There is something blocking ./psql from connecting to anything.
I might want to mention I built it with mingw. I put the bin directory in path. I am using mingw msys2. I don't see a process when I do ps -ef | grep postgres but I can see where the server is running continually. I am using the version on GitHub.
thanks for any ideas on what I can try.
roboloki
Hi thnx for that Andres. Typos may end up being the death of me. Will check tomorrow evening. Thnx!
On Tue, May 7, 2019, 11:11 PM Andrés Rodríguez <andresrodriguez@motumweb.com> wrote:
The port are wrong, you connect 5432, and maybe in postgresql.conf are configured 5342, check numberRegarsEl mar., 7 de mayo de 2019 10:04 p. m., Gavin M2301 <lokiofasgard501@gmail.com> escribió:Hi all-I can't connect by psql like this:./psql -h localhost -p 5432 -d template1.Here is some data:$ ./psql -h 127.0.0.1 -p 5342 -d template1
psql: error: could not connect to server: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5342?
$ ./postgres -d 3 -D C:/msys64/usr/local/pgsql/data -c config_file=/c:/msys64/usr/local/pgsql/data/postgresql.conf2019-05-07 22:39:19.833 EDT [23160] LOG: starting PostgreSQL 12devel on x86_64-w64-mingw32, compiled by x86_64-w64-mingw32-gcc.exe (Rev2, Built by MSYS2 project) 8.3.0, 64-bit
2019-05-07 22:39:19.838 EDT [23160] LOG: listening on IPv6 address "::1", port 5432
2019-05-07 22:39:19.838 EDT [23160] LOG: listening on IPv4 address "127.0.0.1",It (postmaster) is still going. No idea why I can't connect with psql client.Here is my pg_hba.conf:# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trustAny ideas guys/gals?I normally don't get this stuck. There is something blocking ./psql from connecting to anything.I might want to mention I built it with mingw. I put the bin directory in path. I am using mingw msys2. I don't see a process when I do ps -ef | grep postgres but I can see where the server is running continually. I am using the version on GitHub.thanks for any ideas on what I can try.roboloki
Hey laetitia -
I changed the command to launch the server. Now I can see the server process. I can connect with Windows console (cmd). Mingw msys hangs when I try to get to a cmd prompt with psql command. I will just use windows shell.
Last night, I had 2 conflicts. I had a server running from older version of postgres I saw in services, so I uninstalled that prior version. Then I had transposed port number and kept trying to execute it with console history.
So thanks for the help pointing out wrong port number and troubleshooting.
I am off to execute some cmake code to see if soci 4 will work with postgresql.
Thnx- Roboloki
On Wed, May 8, 2019, 3:04 AM Lætitia Avrot <laetitia.avrot@gmail.com> wrote:
Is your server running?You can try `ps -ef | grep postgres` to see if it's running.If you're under a Debian-based distro, try `pg_lsclusters` as root.Have a nice day,LætitiaLe mer. 8 mai 2019 à 05:04, Gavin M2301 <lokiofasgard501@gmail.com> a écrit :Hi all-I can't connect by psql like this:./psql -h localhost -p 5432 -d template1.Here is some data:$ ./psql -h 127.0.0.1 -p 5342 -d template1
psql: error: could not connect to server: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5342?
$ ./postgres -d 3 -D C:/msys64/usr/local/pgsql/data -c config_file=/c:/msys64/usr/local/pgsql/data/postgresql.conf2019-05-07 22:39:19.833 EDT [23160] LOG: starting PostgreSQL 12devel on x86_64-w64-mingw32, compiled by x86_64-w64-mingw32-gcc.exe (Rev2, Built by MSYS2 project) 8.3.0, 64-bit
2019-05-07 22:39:19.838 EDT [23160] LOG: listening on IPv6 address "::1", port 5432
2019-05-07 22:39:19.838 EDT [23160] LOG: listening on IPv4 address "127.0.0.1",It (postmaster) is still going. No idea why I can't connect with psql client.Here is my pg_hba.conf:# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trustAny ideas guys/gals?I normally don't get this stuck. There is something blocking ./psql from connecting to anything.I might want to mention I built it with mingw. I put the bin directory in path. I am using mingw msys2. I don't see a process when I do ps -ef | grep postgres but I can see where the server is running continually. I am using the version on GitHub.thanks for any ideas on what I can try.roboloki