fe_sendauth:在Cloud9 IDE上设置PostgreSQL数据库后,没有提供密码错误 [英] fe_sendauth: no password supplied error after setting up PostgreSQL database on Cloud9 IDE

查看:126
本文介绍了fe_sendauth:在Cloud9 IDE上设置PostgreSQL数据库后,没有提供密码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我已根据投票最高的评论的说明在我的cloud9 IDE帐户上设置了PostgreSQL数据库: Cloud9 postgres

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

这是我的database.yml文件的样子:

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

然后我创建了一个用户模型,进行了迁移,然后重新加载了我的应用程序。但是,当我使用以下命令将应用程序加载到本地服务器上时:cloud9命令行上的 rails服务器-b $ IP -p $ PORT ,我收到以下错误消息: fe_sendauth:无密码错误。我不知道出了什么问题,因为我已经创建了一个具有密码的超级用户,并将其包含在我的database.yml文件中。我发现的唯一发现是,可以通过将pg_hba.conf文件更改为信任本地服务器来解决此错误。但是,我认为在Cloud9 IDE中创建超级用户和密码的全部目的是,您不必这样做。另外,Cloud9不允许您访问pg_hba.conf文件。

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.

推荐答案

您不需要更改pg_hba。 conf文件。
只需在终端中键入以下命令:

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

然后正常重启服务器。
我知道您已经在您提到的说明的开头运行了源〜/ .profile命令(我之前使用过答案,并且遇到过相同问题),但是由于某些神秘的原因,Cloud9环境(我从不需要若要在Mac上执行任何此操作),需要在执行这些说明中指定的设置后再次手动获取'.profile'文件(Cloud 9有时有时会觉得很奇怪-像所有机器一样... du!)。第二条命令使用您的pg gem和database.yml文件中的所有配置在您的开发环境中创建新的pg数据库。

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.

最后的 migrate命令可能不会是必要的,但又出于神秘的原因,在运行 rake db:migrate后,我也修复了数据库问题(如果我没错,它只是更新您的数据库以能够使用您的模型或您可能添加的任何新虚拟数据)

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).

希望这会有所帮助。

这篇关于fe_sendauth:在Cloud9 IDE上设置PostgreSQL数据库后,没有提供密码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆