Thread: No connection could be made because the target machine actively refused it...
No connection could be made because the target machine actively refused it...
From
Frank Moore
Date:
Hi,
I've installed PostgreSQL 9.2 (client and server) on a local Windows desktop and can run pgAdmin to see the postgres database.
However, now I'm trying to install a sample database to have a play with some queries etc...
I'm using psql, connecting to postgres on localhost as the postgres user and running the following command:
postgres# CREATE DATABASE dvdrental;
postgres# pg_restore --dbname=dvdrental --verbose dvdrental.tar
Nothing happens, and in the postgres log I get the following error:
2013-05-30 20:57:07 BST LOG: incomplete startup packet
2013-05-30 20:57:45 BST LOG: could not receive data from client: No connection could be made because the target machine actively refused it.
I've googled this error and it seems that it is probably something to do with my pg_hba.conf file.
I have tried each of the following entries and reloaded the file each time (pg_ctl reload), but to no avail:
# IPv4 local connections:
host all all 255.255.255.255/0 trust
host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 trust
local all all trust
I also have 'listen_addresses = '*'' in my postgresql.conf file.I've installed PostgreSQL 9.2 (client and server) on a local Windows desktop and can run pgAdmin to see the postgres database.
However, now I'm trying to install a sample database to have a play with some queries etc...
I'm using psql, connecting to postgres on localhost as the postgres user and running the following command:
postgres# CREATE DATABASE dvdrental;
postgres# pg_restore --dbname=dvdrental --verbose dvdrental.tar
Nothing happens, and in the postgres log I get the following error:
2013-05-30 20:57:07 BST LOG: incomplete startup packet
2013-05-30 20:57:45 BST LOG: could not receive data from client: No connection could be made because the target machine actively refused it.
I've googled this error and it seems that it is probably something to do with my pg_hba.conf file.
I have tried each of the following entries and reloaded the file each time (pg_ctl reload), but to no avail:
# IPv4 local connections:
host all all 255.255.255.255/0 trust
host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 trust
local all all trust
Can somebody please put me out of my misery and tell me what the entry should be when trying to access the server from a client on the same host?
Many thanks.
Re: No connection could be made because the target machine actively refused it...
From
Amit Langote
Date:
> postgres# CREATE DATABASE dvdrental; > postgres# pg_restore --dbname=dvdrental --verbose dvdrental.tar > It appears that you are running pg_restore inside psql. Have you tried running it in shell and not psql? -- Amit Langote
Fwd: No connection could be made because the target machine actively refused it...
From
Frank Moore
Date:
Hi Amit,
Yes, you're absolutely right. I was running the commands in psql rather than the shell. ---------- Forwarded message ----------
From: Amit Langote <amitlangote09@gmail.com>
Date: 31 May 2013 05:10
Subject: Re: [NOVICE] No connection could be made because the target machine actively refused it...
To: Frank Moore <francis.moore@gmail.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
running it in shell and not psql?
--
Amit Langote
From: Amit Langote <amitlangote09@gmail.com>
Date: 31 May 2013 05:10
Subject: Re: [NOVICE] No connection could be made because the target machine actively refused it...
To: Frank Moore <francis.moore@gmail.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
> postgres# CREATE DATABASE dvdrental;
> postgres# pg_restore --dbname=dvdrental --verbose dvdrental.tar
>
It appears that you are running pg_restore inside psql. Have you tried> postgres# pg_restore --dbname=dvdrental --verbose dvdrental.tar
>
running it in shell and not psql?
--
Amit Langote