Rails:关系 schema_migrations 的权限被拒绝 [英] Rails: permission denied for relation schema_migrations
问题描述
我正在尝试为 Ruby on Rails Web 应用程序设置本地生产环境.我可以使用 rails server
命令运行应用程序,它提供了开发环境.
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.
我尝试设置的生产环境纯粹是本地的,我已经按照本教程使用 apache 2 进行设置:https://www.digitalocean.com/community/tutorials/how-to-setup-a-rails-4-app-with-apache-and-passenger-on-centos-6
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
但是,当我转到我的应用程序页面时,出现以下错误:
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"
在我的 database.yml 中,我有这些用于开发和生产的设置:
in my database.yml I have these settings for development and production:
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)
推荐答案
看来您必须创建一个对您的数据库具有所有所需权限的数据库用户.例如,我认为您可以通过登录您的数据库控制台来实现这一点,然后执行以下操作:
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;
然后像这样更新database.yml
:
adapter: postgresql
database: whiteboard
username: your_new_username
password: your_new_password
pool: 5
timeout: 5000
希望有帮助!
这篇关于Rails:关系 schema_migrations 的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!