fe_sendauth: no password supplied error after setting up PostgreSQL database on Cloud9 IDE

左心房为你撑大大i 提交于 2020-01-03 03:15:46

问题


So I've set up a PostgreSQL database on my cloud9 IDE account according to the instructions of the top voted comment: Cloud9 postgres.

This is what my database.yml file looks like:

default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: <%= ENV['USERNAME'] %>
password: <%= ENV['PASSWORD'] %>
host:     <%= ENV['IP'] %>



development:
  <<: *default
  database: sample_app_development

test:
  <<: *default
  database: sample_app_test

production:
  <<: *default
  database: sample_app_production

I then created a user model, migrated it, and reloaded my app. However when I loaded the app on the local server using this command: rails server -b $IP -p $PORT on the cloud9 command line, I get the following error message: fe_sendauth: no password supplied error. I do not understand what is going wrong since I have created a superuser with a password and have included those in my database.yml file. The only thing I found was that this error can be fixed by changing the pg_hba.conf file to trust the local server. However I thought the whole point of creating a superuser and password in the Cloud9 IDE was so that you don't have to do this. Also Cloud9 doesn't give you access to the pg_hba.conf file.


回答1:


You don't need to change the pg_hba.conf file. Just type in these commands in the terminal:

$ source ~/.profile
$ rake db:create
$ rake db:migrate

Then restart the server normally. I know you already ran the source ~/.profile command at the beginning of the instructions you mentioned (I have used the answer before and struggled with the same issue) but for some mysterious reason Cloud9 environment (I never had to to do any of this on my Mac) requires to manually source the '.profile' file again after doing the setup specified in those instructions (Cloud 9 just decides to be weird sometimes - like all machines... duh!). The second command creates the new pg database in your development environment with all the configuration from your pg gem and your database.yml file.

The final 'migrate' command might not be necessary but again for mysterious reasons I have also had database issues fixed after just running a 'rake db:migrate' (If I am correct it just updates your database to be able to use your Models or any new dummy data you might have added to your development environment).

Hope this helps.



来源:https://stackoverflow.com/questions/35329650/fe-sendauth-no-password-supplied-error-after-setting-up-postgresql-database-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!