postgresql安装在了\cygwin\usr\local\pgsql下,pgsql目录下没data目录,
我在cygwin下敲命令,
$ psqlpsql: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"?是说我psql没开吗,该怎么开?

解决方案 »

  1.   

    psql dbname -U username -h hostname
      

  2.   

    我刚装好的psql,里面没默认的数据啊,有默认的username吗
    我在cygwin上
      

  3.   

    那你先初始化数据库
    initdb --help
    看看这个命令,之后再启动数据库,才可以连接
      

  4.   

    问题是好像找不到initdb这个命令,要配置环境变量吗,我配置了啊,bash.bashrc里配置的
      

  5.   

    我一般只有linux下面用,不过应该只在bin目录里的
      

  6.   

    我装了个虚拟机,上面装了fedora,在这个虚拟机上了yum install postgresql,安装成功了,
    执行initdb,
    也是返回
    initdb: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"? 请大虾帮帮忙
      

  7.   

    /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data试一下。确认你的文件夹存在并有权限。root# mkdir /usr/local/pgsql/data
    root# chown postgres /usr/local/pgsql/data
    root# su postgres
    postgres$ initdb -D /usr/local/pgsql/data
      

  8.   

    Is the server running 的意思是
    首先要開啟postgresql服務器吧,也就是后台程序吧,