Rails:关系schema_migrations的权限被拒绝

时间:2022-10-06 09:58:58

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-导轨-4-应用与 - apache的和 - 乘客上的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)

有没有什么办法解决这一问题? (如果是,请一步一步)

1 个解决方案

#1


7  

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!

希望能帮助到你!

#1


7  

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!

希望能帮助到你!