无法在ubuntu上使用PostgreSQL连接Rails应用程序
我无法将My rails应用程序与在某个实例上运行的Ubuntu服务器上运行的PostgreSQL数据库连接。我使用以下命令创建了新用户和密码。
1-sudo -u postgres createuser -s user1 2-sudo -u postgres psql. 3-postgres=\\password userpass
检查我的database.yml文件,如下所示。
database.yml的:
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.*.*.*
当我尝试使用以下命令创建数据库时rake db:create
它给了我以下错误。
错误:
could not connect to server:connection refused Is the server running on the host:10.*.*.* and accepting TCP/IP connections on the port 5432
我的Ubuntu服务器在给定的IP上运行。但仍然面临与PostgreSQL数据库连接的问题。请帮我解决这个错误。谢谢。
- Heroku语言区域设置无法正常工作
- Rails:如何使用scope来查找数组数组中的元素
- Rails“ActiveRecord_Associations_CollectionProxy的未定义方法”
- ActiveRecord中的PostgreSQL jsonb字段属于关联
- Postgres查询包含内容的JSON数组
- PG错误无法连接到服务器:连接被拒绝服务器是否在端口5432上运行?
- Rails 4 postgres bug – 无法创建数据库,因为pg gem“缺失”,但事实并非如此
- 列“users.id”必须出现在GROUP BY子句中或用于聚合函数
- Rails 4 Postgresql数组数据类型:更新值