Thread: Problem with PostgreSQL: unable to connect to database

Problem with PostgreSQL: unable to connect to database

From
"Cheah Ai Meng"
Date:

Hi PostgreSQL folks!

 

I'm having problems in connecting my PostgreSQL database to the server.  I’m using PostgreSQL 7.3 and pgAdmin II 1.4.  This is the situation:

 

 

1.  At the Cygwin window,

           

eng91066@ENG91066 ~

$ initdb -D /usr/local/pgsql/data

The files belonging to this database system will be owned by user "eng91066".

This user must also own the server process.

 

The database cluster will be initialized with locale C.

 

initdb: The directory /usr/local/pgsql/data exists but is not empty.

If you want to create a new database system, either remove or empty the directory /usr/local/pgsql/data or run initdb with an argument other than /usr/local/pgsql/data.

 

eng91066@ENG91066 ~

$ /usr/bin/pg_ctl -D /usr/local/pgsql/data -o -i -l logfile start

postmaster successfully started

 

 

2.  However, at pgAdmin window, when I tried to connect to the server, this is what I did:

 

Connect to Server

Server:  localhost

Port:  5432

Username:  aiming

Password:  *******

Clicked on “Connect”

 

    And this is the response that I got:

 

An error has occurred in pgAdmin II:frmConnect.cmdConnect_Click:

Number=  -2147467259

Description:  Could not connect to server;

Could not connect to remote socket.

 

 

Does anyone encounter this too?  What was wrong?  Please advice.

 

Regards,

Aiming

 

Re: Problem with PostgreSQL: unable to connect to database

From
"Igor Georgiev"
Date:
 
I'm having problems in connecting my PostgreSQL database to the server.  I’m using PostgreSQL 7.3 and pgAdmin II 1.4.  This is the situation:

 

1.  At the Cygwin window,

           

eng91066@ENG91066 ~

$ initdb -D /usr/local/pgsql/data

The files belonging to this database system will be owned by user "eng91066".

This user must also own the server process.

 

The database cluster will be initialized with locale C.

 

initdb: The directory /usr/local/pgsql/data exists but is not empty.

If you want to create a new database system, either remove or empty the directory /usr/local/pgsql/data or run initdb with an argument other than /usr/local/pgsql/data.

 

eng91066@ENG91066 ~

$ /usr/bin/pg_ctl -D /usr/local/pgsql/data -o -i -l logfile start

postmaster successfully started

try this
/usr/bin/pg_ctl start -D /usr/local/pgsql/data  -l logfile  -o "-i"

Re: Problem with PostgreSQL: unable to connect to database

From
"Igor Georgiev"
Date:
Edit this with accrodance to ur system
 
c:\cygwin/bin/bash --login -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data -i"
 
Also post tail of postmaster log & pg_hba.conf

Re: Problem with PostgreSQL: unable to connect to database

From
"Igor Georgiev"
Date:

Ooops what is this?

 

initdb: The directory /usr/local/pgsql/data exists but is not empty.

If you want to create a new database system, either remove or empty the directory /usr/local/pgsql/data or run initdb with an argument other than /usr/local/pgsql/data.

Re: Problem with PostgreSQL: unable to connect to database

From
"Igor Georgiev"
Date:
This is pgadmin II log
what about a postmaster log ?
----- Original Message -----
Sent: Thursday, January 23, 2003 10:06 AM
Subject: RE: [CYGWIN] Problem with PostgreSQL: unable to connect to database
 

2003-01-23 16:35:17 - *******************************************************************

2003-01-23 16:35:17 - Error(s)

2003-01-23 16:35:17 - *******************************************************************

2003-01-23 16:35:17 - Error in pgAdmin II:frmConnect.cmdConnect_Click: -2147467259 - Could not connect to the server;

Could not connect to remote socket.

 

2003-01-23 16:35:17 - Windows Version: Windows 2000 v5.0 build 2195 Service Pack 3

2003-01-23 16:35:17 - pgSchema Version: 1.4.12

2003-01-23 16:35:17 - MDAC Version: 2.5

2003-01-23 16:35:17 - cnPostgreSQL.State = adStateClosed

 
Ooops what is this?

 

initdb: The directory /usr/local/pgsql/data exists but is not empty.

If you want to create a new database system, either remove or empty the directory /usr/local/pgsql/data or run initdb with an argument other than /usr/local/pgsql/data.

 

This is the response that I see when I typed in initdb -D /usr/local/pgsql/data to initialize the database.  I can’t figure out what is wrong…

 

Thanks again!

 

Regards,

Aiming

Did u try to delete /usr/local/pgsql/data and start initdb again?
Did u have this folders?
/usr/local/pgsql/data
    - /usr/local/pgsql/data/base
        - /usr/local/pgsql/data/base/1
        - /usr/local/pgsql/data/base/16975 - or something like this
 
And take a look here - this is a windows console 4 PostgreSQL

Re: Problem with PostgreSQL: unable to connect to database

From
"Cheah Ai Meng"
Date:

Hi! 

 

Thanks for your advice.  But I’m still getting the same error message at pgAdmin II 1.4.  Please advice me further.  Thanks!

 

 

-----Original Message-----
From: Igor Georgiev [mailto:gory@alphasoft-bg.com]
Sent
:
Thursday, January 23, 2003 5:25 PM
To: Cheah Ai Meng; Pgsql-Cygwin
Subject: Re: [CYGWIN] Problem with PostgreSQL: unable to connect to database

 

 

Hi PostgreSQL folks!

 

I'm having problems in connecting my PostgreSQL database to the server.  I’m using PostgreSQL 7.3 and pgAdmin II 1.4.  This is the situation:

 

 

1.  At the Cygwin window,

           

eng91066@ENG91066 ~

$ initdb -D /usr/local/pgsql/data

The files belonging to this database system will be owned by user "eng91066".

This user must also own the server process.

 

The database cluster will be initialized with locale C.

 

initdb: The directory /usr/local/pgsql/data exists but is not empty.

If you want to create a new database system, either remove or empty the directory /usr/local/pgsql/data or run initdb with an argument other than /usr/local/pgsql/data.

 

eng91066@ENG91066 ~

$ /usr/bin/pg_ctl -D /usr/local/pgsql/data -o -i -l logfile start

postmaster successfully started

 

 

2.  However, at pgAdmin window, when I tried to connect to the server, this is what I did:

 

Connect to Server

Server:  localhost

Port:  5432

Username:  aiming

Password:  *******

Clicked on “Connect”

 

    And this is the response that I got:

 

An error has occurred in pgAdmin II:frmConnect.cmdConnect_Click:

Number=  -2147467259

Description:  Could not connect to server;

Could not connect to remote socket.

 

try this

/usr/bin/pg_ctl start -D /usr/local/pgsql/data  -l logfile  -o "-i"