pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feeddb connection fails
5+ messages / 2 participants
[nested] [flat]
* db connection fails
@ 2002-06-29 19:41 Mark Tessier <mt@open2web.com>
2002-07-01 18:34 ` Re: db connection fails Nick Fankhauser <nickf@ontko.com>
0 siblings, 1 reply; 5+ messages in thread
From: Mark Tessier @ 2002-06-29 19:41 UTC (permalink / raw)
To: pgsql-admin
I get a script error when trying to connect to postgres. It fails in the following part of the script:
PgDatabase conn ("host=localhost dbname=group3");
if (conn.ConnectionBad())
{
...
}
/var/log/messages shows
authentication failure; logname=capmag uid=502 euid=0 tty= ruser = rhost= user=postgres
As "capmag" user with DBCREATE privileges, created db called group3. As I'm accessing group3 via html and C++ script in cgi-bin, I've created a user named "apache" with grant all priviledges in group3.
Mark
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: db connection fails
2002-06-29 19:41 db connection fails Mark Tessier <mt@open2web.com>
@ 2002-07-01 18:34 ` Nick Fankhauser <nickf@ontko.com>
0 siblings, 0 replies; 5+ messages in thread
From: Nick Fankhauser @ 2002-07-01 18:34 UTC (permalink / raw)
To: Mark Tessier <mt@open2web.com>; pgsql-admin
Mark -
A few random thoughts-
When we installed Apache, the user it ran under by default was "www-data".
Are you sure it is running using "apache"?
Have you tried doing a network connection with your "apache" user? (su -
apache; psql -h localhost group3.)
Log file locations may vary by OS flavor, but in Debian, you can find a log
in /var/log/postresql.log. You may have to turn on logging in
postgresql.conf.
-Nick
--------------------------------------------------------------------------
Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788
Ray Ontko & Co. Software Consulting Services http://www.ontko.com/
> -----Original Message-----
> From: pgsql-admin-owner@postgresql.org
> [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Mark Tessier
> Sent: Saturday, June 29, 2002 2:41 PM
> To: pgsql-admin@postgresql.org
> Subject: [ADMIN] db connection fails
>
>
> I get a script error when trying to connect to postgres. It fails
> in the following part of the script:
>
> PgDatabase conn ("host=localhost dbname=group3");
>
> if (conn.ConnectionBad())
> {
> ...
> }
>
> /var/log/messages shows
>
> authentication failure; logname=capmag uid=502 euid=0 tty= ruser
> = rhost= user=postgres
>
> As "capmag" user with DBCREATE privileges, created db called
> group3. As I'm accessing group3 via html and C++ script in
> cgi-bin, I've created a user named "apache" with grant all
> priviledges in group3.
>
>
> Mark
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: db connection fails
@ 2002-07-02 12:31 Nick Fankhauser <nickf@ontko.com>
2002-07-02 18:27 ` Re: db connection fails Mark Tessier <mt@open2web.com>
0 siblings, 1 reply; 5+ messages in thread
From: Nick Fankhauser @ 2002-07-02 12:31 UTC (permalink / raw)
To: Mark Tessier <mt@open2web.com>; +Cc: pgsql-admin
> > Have you tried doing a network connection with your "apache" user? (su -
> > apache; psql -h localhost group3.)
>
> Yes, I've tried it and get the following:
>
> psql: could not connect to server: Connection refused
> Is the server running on host 192.168.1.2 and accepting
> TCP/IP connections on port 5432?
This is a useful clue. It suggests that your code may be fine and that the
problem is in the networking or authentication setup. (You're using TCP/IP
even if you are on the same box.)
If you haven't already done so, take a look at your pg_hba.conf file. Info
on how to set it up can be found here:
http://www.postgresql.org/idocs/index.php?client-authentication.html
-Nick
--------------------------------------------------------------------------
Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788
Ray Ontko & Co. Software Consulting Services http://www.ontko.com/
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: db connection fails
2002-07-02 12:31 Re: db connection fails Nick Fankhauser <nickf@ontko.com>
@ 2002-07-02 18:27 ` Mark Tessier <mt@open2web.com>
2002-07-02 18:43 ` Re: db connection fails Nick Fankhauser <nickf@ontko.com>
0 siblings, 1 reply; 5+ messages in thread
From: Mark Tessier @ 2002-07-02 18:27 UTC (permalink / raw)
To: Nick Fankhauser <nickf@ontko.com>; +Cc: pgsql-admin
> > > Have you tried doing a network connection with your "apache" user? (su -
> > > apache; psql -h localhost group3.)
> >
> > Yes, I've tried it and get the following:
> >
> > psql: could not connect to server: Connection refused
> > Is the server running on host 192.168.1.2 and accepting
> > TCP/IP connections on port 5432?
> This is a useful clue. It suggests that your code may be fine and that the
> problem is in the networking or authentication setup. (You're using TCP/IP
> even if you are on the same box.)
>
> If you haven't already done so, take a look at your pg_hba.conf file. Info
> on how to set it up can be found here:
>
I've done so and find the following:
# TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
local all trust
host all 127.0.0.1 255.255.255.255 trust
This means I should already be able to connect, although it's stated that "TCP/IP connections are completely disabled unless the server is started with the -i switch or the equivalent configuration parameter is set."
So, how do I restart postgres with the -i switch set, and is there a conf file to modify so that postgres starts up with the -i switch set when I turn on the machine? Normally I restart postgres like this
/etc/rc.d/init.d/postgresql restart
--
Thanks,
Mark
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: db connection fails
2002-07-02 12:31 Re: db connection fails Nick Fankhauser <nickf@ontko.com>
2002-07-02 18:27 ` Re: db connection fails Mark Tessier <mt@open2web.com>
@ 2002-07-02 18:43 ` Nick Fankhauser <nickf@ontko.com>
0 siblings, 0 replies; 5+ messages in thread
From: Nick Fankhauser @ 2002-07-02 18:43 UTC (permalink / raw)
To: Mark Tessier <mt@open2web.com>; +Cc: pgsql-admin
Mark-
If you're on version 7.1 or higher, the proffered way to turn on tcp/ip is
to add "tcpip_socket=true" to postgresql.conf in the data directory. (Then
restart.) Details are here:
http://www.postgresql.org/idocs/index.php?runtime-config.html
Regards,
-Nick
> -----Original Message-----
> From: Mark Tessier [mailto:mt@open2web.com]
> Sent: Tuesday, July 02, 2002 1:27 PM
> To: Nick Fankhauser
> Cc: pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] db connection fails
>
>
> > > > Have you tried doing a network connection with your
> "apache" user? (su -
> > > > apache; psql -h localhost group3.)
> > >
> > > Yes, I've tried it and get the following:
> > >
> > > psql: could not connect to server: Connection refused
> > > Is the server running on host 192.168.1.2 and accepting
> > > TCP/IP connections on port 5432?
>
> > This is a useful clue. It suggests that your code may be fine
> and that the
> > problem is in the networking or authentication setup. (You're
> using TCP/IP
> > even if you are on the same box.)
> >
> > If you haven't already done so, take a look at your pg_hba.conf
> file. Info
> > on how to set it up can be found here:
> >
> I've done so and find the following:
>
> # TYPE DATABASE IP_ADDRESS MASK
> AUTH_TYPE AUTH_ARGUMENT
>
> local all trust
> host all 127.0.0.1 255.255.255.255 trust
>
> This means I should already be able to connect, although it's
> stated that "TCP/IP connections are completely disabled unless
> the server is started with the -i switch or the equivalent
> configuration parameter is set."
>
> So, how do I restart postgres with the -i switch set, and is
> there a conf file to modify so that postgres starts up with the
> -i switch set when I turn on the machine? Normally I restart
> postgres like this
>
> /etc/rc.d/init.d/postgresql restart
>
> --
> Thanks,
>
> Mark
>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2002-07-02 18:43 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-29 19:41 db connection fails Mark Tessier <mt@open2web.com>
2002-07-01 18:34 ` Nick Fankhauser <nickf@ontko.com>
2002-07-02 12:31 Re: db connection fails Nick Fankhauser <nickf@ontko.com>
2002-07-02 18:27 ` Mark Tessier <mt@open2web.com>
2002-07-02 18:43 ` Nick Fankhauser <nickf@ontko.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox