Cloud9 postgres

后端 未结 7 1368
我在风中等你
我在风中等你 2020-12-01 03:49

I am trying to set up a postgres database in a Rails app in Cloud9.

I have followed the instructions here: https://docs.c9.io/setting_up_postgresql.html and set up

7条回答
  •  有刺的猬
    2020-12-01 04:21

    The postgresql in cloud9 is setup to authenticate with peer when localhost connection. So the quickly resolution is change the user in your database.yaml to current user. In my case the name of user is ubuntu. To see your current user use the command

    $ echo $USER

    So a list of command in terminal is .

    $ sudo su - postgres
    $ createuser ubuntu -dslP
    $ Enter password for new role: **same password from your yaml file**
    $ Enter it again:
    

    Set your yaml file like this

    development:
      adapter: postgresql
      encoding: SQL_ASCII
      database: cc_database
      pool: 5
      username: ubuntu
      password: password
    

    Now you can run

    rake db:create
    rake db:migrate
    

提交回复
热议问题