Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: permission denied for relation schema_migrations

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.

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"

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)

like image 980
Victoria S. Avatar asked Nov 19 '15 10:11

Victoria S.


1 Answers

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:

adapter: postgresql
database: whiteboard
username: your_new_username
password: your_new_password
pool: 5
timeout: 5000

Hope it helps!

like image 104
Olivier Avatar answered Oct 12 '22 15:10

Olivier