postgresql Rails:关系 schema_migrations 的权限被拒绝
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33801628/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Rails: permission denied for relation schema_migrations
提问by Victoria S.
I'm trying to setup a local production environment for a Ruby on Rails web application. I can run the application with rails server
command, which gives the development environment.
我正在尝试为 Ruby on Rails Web 应用程序设置本地生产环境。我可以使用rails server
命令运行应用程序,它提供了开发环境。
The production environment I'm trying to set up is purely local and I've followed this tutorial for setting it up with apache 2: https://www.digitalocean.com/community/tutorials/how-to-setup-a-rails-4-app-with-apache-and-passenger-on-centos-6
我试图设置的生产环境纯粹是本地的,我已经按照本教程使用 apache 2 进行设置:https: //www.digitalocean.com/community/tutorials/how-to-setup-a- rails-4-app-with-apache-and-passenger-on-centos-6
However when I go to the page of my application I get the following error:
但是,当我转到我的应用程序页面时,出现以下错误:
PG::InsufficientPrivilege: ERROR: permission denied for relation schema_migrations : SELECT "schema_migrations".* FROM "schema_migrations"
in my database.yml I have these settings for development and production:
在我的 database.yml 中,我有这些用于开发和生产的设置:
adapter: postgresql
database: whiteboard
username:
password:
pool: 5
timeout: 5000
I'm not allowed to change these settings, no matter what.
无论如何,我都不允许更改这些设置。
Is there any way to fix this? (if yes, step by step please)
有没有什么办法解决这一问题?(如果是,请一步一步)
采纳答案by Olivier Buffon
It seems you have to create a DB user with all needed privileges on your DB. For example I think you could do the trick by log in your DB console then do something like:
似乎您必须创建一个对您的数据库具有所有所需权限的数据库用户。例如,我认为您可以通过登录数据库控制台来实现这一点,然后执行以下操作:
CREATE USER your_new_username WITH PASSWORD 'your_new_password';
CREATE DATABASE whiteboard;
GRANT ALL PRIVILEGES ON DATABASE whiteboard to your_new_username;
ALTER DATABASE whiteboard OWNER TO your_new_username;
Then update you database.yml
like this:
然后database.yml
像这样更新你:
adapter: postgresql
database: whiteboard
username: your_new_username
password: your_new_password
pool: 5
timeout: 5000
Hope it helps!
希望能帮助到你!