Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2003
    Location
    NorthWest
    Posts
    10

    Unanswered: psql connecting error

    Hello, I succesfuly installed PostgreSQL 7.3.3 on Cygwin 1.3.22.
    I am running WinXP Professional, and the PostgreSQL and ipc-daemon, are installed as Windows services.

    Well I can stop them, and start them and everything seems to look normal.

    The point is that I can't connect with psql command to the server, but I can connect with phpPgAdmin, and make all operations available there.

    I realy need to use psql command, but when I try to connect I receive this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    $ psql -d template1 -U postgre

    psql: could not connect to server: Bad file descriptor
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    My pgsql data directory is: /home/postgre/data/

    I also verify the pg_hba.conf file an have there:
    # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD

    local all all trust
    host all all 127.0.0.1 255.255.255.255 trust

    So it looks ok, and I even uncomment the line port = 5432 from postgresql.conf.

    I just don't know what is happening.

    I even try this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    $ pg_ctl status
    pg_ctl: no database directory or environment variable $PGDATA is specified
    Try 'pg_ctl --help' for more information.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Can someone help me? Thanks.
    The more people I now, the more I love my dog.

  2. #2
    Join Date
    Dec 2003
    Location
    Macedonia (nobody's former republic)
    Posts
    8

    Re: psql connecting error

    Just a stupid suggestion, but have you set PGDATA=/home/postgre/data in your .profile?
    Also, I see psql using Unix Domain sockets (not TCP) - have you checked the TCP configuration?

  3. #3
    Join Date
    Sep 2003
    Location
    NorthWest
    Posts
    10
    Actualy I am just connecting with psql -h localhost, and everything works good. Thanks for your suggestion.

    P.S. By the way where is .profile located?
    Last edited by FlashMagnuM; 01-05-04 at 03:25.
    The more people I now, the more I love my dog.

  4. #4
    Join Date
    Dec 2003
    Location
    Macedonia (nobody's former republic)
    Posts
    8
    Originally posted by FlashMagnuM
    Actualy I am just connecting with psql -h localhost, and everything works good. Thanks for your suggestion.

    P.S. By the way where is .profile located?
    In your home directory (typically /home/<yourusername>). If you are using bash shell (and you do, most probably) it will be .bash_profile (and you can also use .bashrc). You won't see them with simple ls, try ls -a to see all files (just pop up a console and do ls -a).

  5. #5
    Join Date
    Jan 2004
    Posts
    19

    Re: psql connecting error

    Is the database local or remote? If it is remote, do you connect to the server through ssh? If its local, you should install everything through cygwin and not NT. Connect to whatever server first using ssh and then use psql.

    Originally posted by FlashMagnuM
    Hello, I succesfuly installed PostgreSQL 7.3.3 on Cygwin 1.3.22.
    I am running WinXP Professional, and the PostgreSQL and ipc-daemon, are installed as Windows services.

    Well I can stop them, and start them and everything seems to look normal.

    The point is that I can't connect with psql command to the server, but I can connect with phpPgAdmin, and make all operations available there.

    I realy need to use psql command, but when I try to connect I receive this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    $ psql -d template1 -U postgre

    psql: could not connect to server: Bad file descriptor
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    My pgsql data directory is: /home/postgre/data/

    I also verify the pg_hba.conf file an have there:
    # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD

    local all all trust
    host all all 127.0.0.1 255.255.255.255 trust

    So it looks ok, and I even uncomment the line port = 5432 from postgresql.conf.

    I just don't know what is happening.

    I even try this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    $ pg_ctl status
    pg_ctl: no database directory or environment variable $PGDATA is specified
    Try 'pg_ctl --help' for more information.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Can someone help me? Thanks.

  6. #6
    Join Date
    Jan 2004
    Posts
    19

    Re: psql connecting error

    Also be familiar with the -h -U and -d options of psql. ssh into your remote connection and then login as: psql [-U username] databasename. Again, if you set up postgreSQL locally, do it through cygwin only. If you want to do it through NT only, use MySQL instead.

    Originally posted by FlashMagnuM
    Hello, I succesfuly installed PostgreSQL 7.3.3 on Cygwin 1.3.22.
    I am running WinXP Professional, and the PostgreSQL and ipc-daemon, are installed as Windows services.

    Well I can stop them, and start them and everything seems to look normal.

    The point is that I can't connect with psql command to the server, but I can connect with phpPgAdmin, and make all operations available there.

    I realy need to use psql command, but when I try to connect I receive this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    $ psql -d template1 -U postgre

    psql: could not connect to server: Bad file descriptor
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    My pgsql data directory is: /home/postgre/data/

    I also verify the pg_hba.conf file an have there:
    # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD

    local all all trust
    host all all 127.0.0.1 255.255.255.255 trust

    So it looks ok, and I even uncomment the line port = 5432 from postgresql.conf.

    I just don't know what is happening.

    I even try this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    $ pg_ctl status
    pg_ctl: no database directory or environment variable $PGDATA is specified
    Try 'pg_ctl --help' for more information.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Can someone help me? Thanks.

  7. #7
    Join Date
    Mar 2004
    Posts
    1

    Re: psql connecting error

    Originally posted by vidmas
    Also be familiar with the -h -U and -d options of psql. ssh into your remote connection and then login as: psql [-U username] databasename. Again, if you set up postgreSQL locally, do it through cygwin only. If you want to do it through NT only, use MySQL instead.
    Hi, I had the same problem.

    Try with the next:
    - export PGDATA=/usr/local/pgsql/data (set your path)
    - pg_ctl status

  8. #8
    Join Date
    Mar 2004
    Posts
    110

    Re: psql connecting error

    Originally posted by FlashMagnuM
    Hello, I succesfuly installed PostgreSQL 7.3.3 on Cygwin 1.3.22.
    I am running WinXP Professional, and the PostgreSQL and ipc-daemon, are installed as Windows services.

    Well I can stop them, and start them and everything seems to look normal.

    The point is that I can't connect with psql command to the server, but I can connect with phpPgAdmin, and make all operations available there.

    I realy need to use psql command, but when I try to connect I receive this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    $ psql -d template1 -U postgre

    psql: could not connect to server: Bad file descriptor
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    My pgsql data directory is: /home/postgre/data/

    I also verify the pg_hba.conf file an have there:
    # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD

    local all all trust
    host all all 127.0.0.1 255.255.255.255 trust

    So it looks ok, and I even uncomment the line port = 5432 from postgresql.conf.

    I just don't know what is happening.

    I even try this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    $ pg_ctl status
    pg_ctl: no database directory or environment variable $PGDATA is specified
    Try 'pg_ctl --help' for more information.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Can someone help me? Thanks.
    i use cygwin 2.0 with postgresql and ipc-daemon on a windows 2003 server and i got the same setup on a XP Pro system.

    What i do is the following.
    I open a cygwin shell
    $ postmaster -D /home/postgre/data/ -i
    (postmaster is my windows service)

    it will then start the db.

    I open a second cygwin shell:
    $ psql -U <username> <databasename>

    Works like a charm for me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •