EnterpriseDB: The Enterprise Postgres Company Postgres Plus Forums: The PostgreSQL Open Source Database from EnterpriseDB
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 

unix_socket_directory  XML

Forum Index » PostgreSQL Installers for Windows, Linux and OS X
Author Message
Venkat_B

Member

Joined: 16 Jun 2008 08:39:02
Messages: 45
Offline

Hi,

I installed PostgreSQL 8.4 Version in my test machine. Installation was successful and everything goes fine(like creating DB, connection and creation of tables etc.,). Now i tried to change the parameter unix_socket_directory to point the postgres startup socket lock file to some other location other than /tmp. When i start the PostgreSQl it's starting the DB and socket lock file got created at mentioned path, but when trying to connect from command prompt to any DB it's throwing error like:

psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

I also tried by mentioning the path in .bash_profile but there is no luck.

Do i need to mention or define some in any other files.

Thanks in advance for support.

Thanks,
Venkat.
Ashesh_V

Senior member

Joined: 21 Dec 2008 00:54:03
Messages: 205
Offline

How did you call psql?
You may need to call psql with -h|--host command-line argument.

Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA - The Enterprise Postgres Company
Venkat_B

Member

Joined: 16 Jun 2008 08:39:02
Messages: 45
Offline

Hi,

Normally as i'm connecting from localhost itself i just give "psql template1". But in this case i have tested with both cases where the result is same error.

These are the following commands i used to connect:

cmd1: psql template1
cmd2: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres
cmd3: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres -h localhost -p 5432
cmd4: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres -h 127.0.0.1 -p 5432

Where the result was same error.

Thanks,
Venkat
Venkat_B

Member

Joined: 16 Jun 2008 08:39:02
Messages: 45
Offline

Hi,

I'm sorry i have tested only cmd1 and cmd 2 from which i mentioned in above message:

cmd1: psql template1
cmd2: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres

It's working fine with these commands:

cmd3: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres -h localhost -p 5432
cmd4: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres -h 127.0.0.1 -p 5432


Sorry again and thanks for support.

Thanks,
Venkat.
Ashesh_V

Senior member

Joined: 21 Dec 2008 00:54:03
Messages: 205
Offline

Glad to help you.

Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA - The Enterprise Postgres Company
Vibhor_K

Senior member
[Avatar]

Joined: 3 Jul 2009 09:46:15
Messages: 444
Offline


cmd3: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres -h localhost -p 5432
cmd4: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres -h 127.0.0.1 -p 5432


Above two commands do not use Unix_Socket to connect to database.

You need to check the value of parameter "unix_socket_directory" in postgresql.conf file of data directory.

Default unix_socket_directory is /tmp. However, in you case it seems value of unix_socket_directory is different. Due to which psql is giving the error
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?


If you want to connect to database using unix socket, then use following option:
psql -h <unix_socket_directory>



Thanks & Regards,
Vibhor Kumar
Blog:http://vibhork.blogspot.com
[Email] [WWW]
Venkat_B

Member

Joined: 16 Jun 2008 08:39:02
Messages: 45
Offline

Thanks Vibhor,

It helped me in learning one new thing today.

I have changed the parameter "unit_socket_directory" in my postgresql.conf file to point the postgresql sokcet lock files to other location(/home/postgres/tmp) during startup. But the other two commands which i have mentioned is also working fine to get connected with new "unit_socket_directory" location.

I was not clear how it's working, anyway thanks again for giving new source/command to get connected when the parameter is changed.

Now these three commands are working to get connected:

cmd3: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres -h localhost -p 5432
cmd4: /opt/PostgreSQL/8.4/bin/psql -d template1 -U postgres -h 127.0.0.1 -p 5432
cmd5: psql -h <socket_directory_path>(Ex: psql -h /tmp/socket_test/)

I have tested it with my test box too and it's great....

Thanks,
Venkat.
 
Forum Index » PostgreSQL Installers for Windows, Linux and OS X
Go to:   
Powered by JForum 2.1.8 © JForum Team