Thread: Problem Adding A PostgreSQL Server in Debian

Problem Adding A PostgreSQL Server in Debian

From
Sunburned Surveyor
Date:
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY:
Arial">I'veinstalled PostgreSQL, and set it up with a user that has the same user name and password as one of the Linux
Users.I have no problem logging into the psql terminal with the user via the command line. Once I am logged into psql,
Ican execute the CREATE DATABASE and CREATE TABLE commands with no problem. </span></font><p class="MsoNormal"><font
face="Arial"size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font><font face="Arial" size="2"><span
style="FONT-SIZE:10pt; FONT-FAMILY: Arial">However, when I tried to add a server in pgAdmin3 with the same user and
password,I get this error: </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt;
FONT-FAMILY:Arial"> </span></font><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">"An
errorhas occurred:</span> </font><p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt;
FONT-FAMILY:Arial"></span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt;
FONT-FAMILY:Arial">Error connecting to the server: FATAL:IDENT authentication failed for user "myuser"
"</span></font><pclass="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY:
Arial"> </span></font><fontface="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I have checked my
pg_hba.conffile and everything appears to be as it should be. (Although I'm not an expert, and I could be missing
something.)It is set up to accepts all connections from the local machine. </span></font><p class="MsoNormal"><font
face="Arial"size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> </span></font><font face="Arial" size="2"><span
style="FONT-SIZE:10pt; FONT-FAMILY: Arial">Do you guys have any suggestions for me? I'm thinking the problem is with
pgAdmin3,since I can connect to PostgreSQL via the psql terminal with no problems, but I'm not sure. </span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I'm running the latest
stableversion of both PostgreSQL and pgAdmin3. </span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="FONT-SIZE:10pt; FONT-FAMILY: Arial"></span></font><font face="Arial" size="2"><span style="FONT-SIZE: 10pt;
FONT-FAMILY:Arial">Thanks,</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="FONT-SIZE: 10pt;
FONT-FAMILY:Arial">The Sunburned Surveyor</span></font><p class="MsoNormal"> </div> 

Re: Problem Adding A PostgreSQL Server in Debian

From
Sunburned Surveyor
Date:
I had posted a couple of weeks back about a problem I had using pgAdmin3. I was basically unable to add a new server to PostgreSQL from pgAdmin. I received the following error message:
 
"An error has occurred: Error connecting to the server: FATAL:IDENT authentication failed for user "myuser" "
 
I was able to determine the cause of this error. (Sort of...) I wanted to post it back to the list so that other newbies might run across it while they are searching the archives.
 
Apparently there are a couple of ways to connect to PostgreSQL from a client. One of them is via UNIX sockets as a UNIX user. (Or Linux Sockets as a Linux User.) Another is via TCP/IP.
 
I could successfully connect to PostgreSQL and issue commands via the psql command prompt. With this command for example:
 
psql -U postgres tempate1
 
However, I couldn't connect with this command:
 
psql -h localhost -U postgres template1
 
This meant that I was connecting as a Linux user via a socket, and not via TCP/IP.
 
If this happens to you, there are a couple of things that you can check:
 
[1] Issue the 2 commands mentioned above. If the first one works, but the second one generates the error message, you probably have the same problem I did.
 
[2] Make sure that postgresql.conf file contains a line that reads "tcpip_socket = true", not "tcpip_socket = false". On my Debian Sarge system the postgresql.conf file could be found at /etc/postgresql/ You will need root access privileges to modify it.
 
[3] Make sure that your pg_hba.conf file is set up to accept tcp/ip connections. I believe this is done by accepting all connections on the local host. You should have a line in your hba_conf.file that looks like this:
 
host   all   all   127.0.0.1   255.255.255.255   trust
 
(This might set up your PostgreSQL to accept all connections from the local or host computer. You might not want this. Perhaps one of the other experts can tell us how to set up the file to allow tcp/ip access but maintain password verification on the local computer.)
 
On my Debian Sarge system you can find the postgresql.conf file at /etc/postgresql. You will need root access privileges to modify it.
 
 
I hope this will help any pgAdmin 3 users that run into the same problem I did. I am curious why I didn't recieve a response from the mailing list. Did I violate a rule of ettiquette, or not provide enough information?
 
My next question would be:
 
How do you set up pgAdmin to connect to PostgreSQL via Unix Sockets?
 
I believe I read that this can be done with pgAdmin3.
 
Thanks,
 
The Sunburned Surveyor

 
On 12/16/05, Sunburned Surveyor <sunburned.surveyor@gmail.com> wrote:

I've installed PostgreSQL, and set it up with a user that has the same user name and password as one of the Linux Users. I have no problem logging into the psql terminal with the user via the command line. Once I am logged into psql, I can execute the CREATE DATABASE and CREATE TABLE commands with no problem.

 However, when I tried to add a server in pgAdmin3 with the same user and password, I get this error:

 "An error has occurred:

Error connecting to the server: FATAL:IDENT authentication failed for user "myuser" "

 I have checked my pg_hba.conf file and everything appears to be as it should be. (Although I'm not an expert, and I could be missing something.) It is set up to accepts all connections from the local machine.

 Do you guys have any suggestions for me? I'm thinking the problem is with pgAdmin3, since I can connect to PostgreSQL via the psql terminal with no problems, but I'm not sure.

I'm running the latest stable version of both PostgreSQL and pgAdmin3. 

Thanks,

The Sunburned Surveyor

 


Re: Problem Adding A PostgreSQL Server in Debian

From
Andreas Pflug
Date:
Sunburned Surveyor wrote:
> I had posted a couple of weeks back about a problem I had using 
> pgAdmin3. I was basically unable to add a new server to PostgreSQL from 
> pgAdmin. I received the following error message:
>  
> "An error has occurred: Error connecting to the server: FATAL:IDENT 
> authentication failed for user "myuser" "
>  
> I was able to determine the cause of this error. (Sort of...) I wanted 
> to post it back to the list so that other newbies might run across it 
> while they are searching the archives.
>  
> Apparently there are a couple of ways to connect to PostgreSQL from a 
> client. One of them is via UNIX sockets as a UNIX user. (Or Linux 
> Sockets as a Linux User.) Another is via TCP/IP.
>  
> I could successfully connect to PostgreSQL and issue commands via the 
> psql command prompt. With this command for example:
>  
> psql -U postgres tempate1
>  
> However, I couldn't connect with this command:
>  
> psql -h localhost -U postgres template1
>  
> This meant that I was connecting as a Linux user via a socket, and not 
> via TCP/IP.
>  
> If this happens to you, there are a couple of things that you can check:
>  
> [1] Issue the 2 commands mentioned above. If the first one works, but 
> the second one generates the error message, you probably have the same 
> problem I did.
>  
> [2] Make sure that postgresql.conf file contains a line that reads 
> "tcpip_socket = true", not "tcpip_socket = false". On my Debian Sarge 
> system the postgresql.conf file could be found at /etc/postgresql/ You 
> will need root access privileges to modify it.
>  
> [3] Make sure that your pg_hba.conf file is set up to accept tcp/ip 
> connections. I believe this is done by accepting all connections on the 
> local host. You should have a line in your hba_conf.file that looks like 
> this:
>  
> host   all   all   127.0.0.1 <http://127.0.0.1>   255.255.255.255 
> <http://255.255.255.255>   trust
>  
> (This might set up your PostgreSQL to accept all connections from the 
> local or host computer. You might not want this. Perhaps one of the 
> other experts can tell us how to set up the file to allow tcp/ip access 
> but maintain password verification on the local computer.)
>  
> On my Debian Sarge system you can find the postgresql.conf file at 
> /etc/postgresql. You will need root access privileges to modify it.
>  
>  
> I hope this will help any pgAdmin 3 users that run into the same problem 
> I did. I am curious why I didn't recieve a response from the mailing 
> list. Did I violate a rule of ettiquette, or not provide enough 
> information?
>  
> My next question would be:
>  
> How do you set up pgAdmin to connect to PostgreSQL via Unix Sockets?

How about having a look at pgAdmin's help....

Regards,
Andreas