Why can't I connect to PostgreSQL from RazorSQL?

333 views Asked by At

I have PostgreSQL 9.2.23 running in CentOS 7.4.1708 (all software updates installed) in a VirtualBox VM in OS X 10.12.6. I had this working yesterday but my VM got hosed and I had to recreate it from scratch. Now I can't connect from the host using RazorSQL.

I did the following:

su root
systemctl disable firewalld
yum install postgresql-server 
postgresql-setup initdb
chkconfig postgresql on 
reboot

edit /var/lib/pgsql/data/pg_hba.conf:

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             0.0.0.0/0               trust

edit /var/lib/pgsql/data/postgresql.conf:

listen_addresses = '*'              # what IP address(es) to listen on;

systemctl restart postgresql.service

sudo -u postgres psql
create user robert with password 'robert';
create database robertdb;
grant all on database robertdb to robert;
\q
psql -U robert -d robertdb;
create schema robert;
alter role robert set search_path to robert;
\q

The RazorSQL error is:

ERROR: An error occurred while trying to connect to the database:
JDBC URL: jdbc:postgresql://192.168.7.53:5432/robertdb
The connection attempt failed.

The IP address is correct, I can ping it from the host, and since I was able to connect yesterday I know the driver isn't the problem.

Mac:

Port Scanning host: 192.168.7.53

     Open TCP Port:     22          ssh
     Open TCP Port:     111         sunrpc
     Open TCP Port:     5432        postgresql
Port Scan has completed…

CentOS:

Nmap scan report for localhost (127.0.0.1)
Host is up (0.00028s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 995 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
25/tcp   open  smtp
111/tcp  open  rpcbind
631/tcp  open  ipp
5432/tcp open  postgresql

root@localhost robert]# cat /var/lib/pgsql/data/postgresql.conf | grep "listen"
listen_addresses = '*'              # what IP address(es) to listen on;

[root@localhost robert]# cat /var/lib/pgsql/data/pg_hba.conf | grep "trust"
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
local   all             all                                     trust
host    all             all             0.0.0.0/0               trust

Tried Postico to eliminate RazorSQL as the problem and it connected. Strange.

0

There are 0 answers