Ruby 无法将Rails应用程序与ubuntu上的PostgreSQL连接
我无法将我的rails应用程序连接到PostgreSQL数据库,该数据库正在我的Ubuntu服务器上运行,在某些实例上运行。我使用以下命令创建了新的用户和密码Ruby 无法将Rails应用程序与ubuntu上的PostgreSQL连接,ruby,postgresql,ruby-on-rails-4,ubuntu,Ruby,Postgresql,Ruby On Rails 4,Ubuntu,我无法将我的rails应用程序连接到PostgreSQL数据库,该数据库正在我的Ubuntu服务器上运行,在某些实例上运行。我使用以下命令创建了新的用户和密码 1-sudo -u postgres createuser -s user1 2-sudo -u postgres psql. 3-postgres=\\password userpass 检查下面给出的my database.yml文件 database.yml: 当我试图使用下面的命令rake db:create创建数据库时,它给了
1-sudo -u postgres createuser -s user1
2-sudo -u postgres psql.
3-postgres=\\password userpass
检查下面给出的my database.yml文件
database.yml:
当我试图使用下面的命令rake db:create创建数据库时,它给了我下面的错误
错误:
我的Ubuntu服务器正在给定的IP上运行。但仍然面临连接PostgreSQL数据库的问题。请帮助我解决此错误。谢谢。请不要使用host@nik:根据您的说法,我删除了主机,但它给出了错误“致命:用户user1的对等身份验证失败”。请按照此和您的问题将得到解决检查防火墙设置。如果端口5432处于打开状态,请验证您的pg_hba.conf,使其包含具有md5或trust的应用程序/客户端IP条目。如果更改pg_hba.conf,请确保在postgres中重新加载配置。postgresql.conf中的侦听地址是什么?
development:
adapter: postgresql
encoding: unicode
database: 100sallon_development
pool: 5
username: user1
password: *******
host: 10.*.*.*
test:
adapter: postgresql
encoding: unicode
database: 100sallon_test
pool: 5
username: user1
password: *******
host: 10.*.*.*
production:
adapter: postgresql
encoding: unicode
database: 100sallon_production
pool: 5
username: user1
password: ******
host: 10.*.*.*
could not connect to server:connection refused
Is the server running on the host:10.*.*.* and accepting
TCP/IP connections on the port 5432