rails 3.2.2 (or 3.2.1) + Postgresql 9.1.3 + Ubuntu 11.10 Connection error

前端 未结 2 399
有刺的猬
有刺的猬 2021-02-02 04:25

I am using PostgreSQL 9.1.3 (PostgreSQL 9.1.3 on x86_64-pc-linux-gnu, compiled by gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1, 64-bit) and rails either 3.2.2 or 3.2.1 on u

2条回答
  •  一生所求
    2021-02-02 04:45

    try this way,

    sudo -u postgres createuser -D -P your-current-ubuntu-username
    

    and

    sudo -u postgres createdb -O your-current-ubuntu-username your-database
    

    open up this file /etc/postgresql/9.1/main/pg_hba.conf

    change this line only:

    local   all             all                                     peer
    

    to this:

    local   all             all                                     md5
    

    Don't forget to restart the postgres server:

    sudo service postgresql restart
    

    Now check, with this command

    psql -d your-database -U your-current-ubuntu-username -W
    

    it should work

    This solutions works for postgresql-9.1, here is the way to install

    sudo apt-get install postgresql-9.1
    

提交回复
热议问题