ruby-on-rails – Rails:rake db:create:all无法连接到Postgr
我正在尝试创建一个使用PostgreSQL的Rails应用程序.这是对我所做的描述.
PostgreSQL设置: >我添加了一个数据库用户,该用户拥有与我的Ubuntu帐户同名的数据库的超级用户权限. 我在pg_hba.conf中的postgres配置如下(为了便于阅读,删除了注释). [...] local all postgres peer local all all peer host all all 127.0.0.1/32 md5 host all all ::1/128 md5 Rails设置: >我通过RVM安装了Ruby 1.9.3-p125. 这是我的config / database.yml的内容(为了便于阅读,删除了注释). development: adapter: postgresql encoding: unicode database: my_test_app_development pool: 5 username: johndoe password: password host: localhost port: 5433 test: adapter: postgresql encoding: unicode database: my_test_app_test pool: 5 username: johndoe password: password 问题: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? [...] Couldn't create database for {"adapter"=>"postgresql","encoding"=>"unicode","database"=>"my_test_app_test","pool"=>5,"username"=>"johndoe","password"=>"password"} 题: 解决方法
@Riateche:最后,我看到测试环境的数据库配置错过了主机和端口的显式设置.将设置添加到测试环境后,我能够成功运行命令bundle exec rake db:create:all.
我必须说,我不喜欢他们建议开发环境的那些设置,但没有为其他环境添加它们.正如我所证明的那样,这很可能会错过它们. test: adapter: postgresql encoding: unicode database: my_test_app_test pool: 5 username: johndoe password: password host: localhost port: 5433 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- cvc-complex-type.2.4.a: Invalid content was found start
- 从jsf.ajax.addOnEvent()中止JSF Ajax请求
- Vue.js学习教程之列表渲染详解
- ruby-on-rails – 如何在rails应用程序中覆盖gem的类方法?
- c – 将doxygen doxument设为#ifdef部分
- c# – 如何在Windows Phone 8中设置背景图像?
- ruby-on-rails – Rails从多态模型加入或预加载belongs_to关
- ruby – Emacs OSX中的Bash没有找到通过terminal.app安装的
- Vue.js——基于$.ajax实现数据的跨域增删查改
- SQLite语法