Rails:PG::InsufficientPrivilege:错误:关系 schema_migrations 的权限被拒绝 [英] Rails: PG::InsufficientPrivilege: ERROR: permission denied for relation schema_migrations

查看:121
本文介绍了Rails:PG::InsufficientPrivilege:错误:关系 schema_migrations 的权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Rails 中创建数据库.在 Postgres 中,我看到了开发和测试数据库,但是,我收到了权限错误.我尝试点击此链接,但对我不起作用.

I'm trying to create the database in Rails. In Postgres I see the development and test database, however, I'm getting a permissions error. I've tried to follow this link, didn't work for me.

错误:PG::InsufficientPrivilege:错误:关系schema_migrations的权限被拒绝:SELECTschema_migrations".* FROMschema_migrations"

Rails:关系 schema_migrations 的权限被拒绝

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5
  host: localhost
  username: root
  password:

development:
  <<: *default
  database: svp-chicago_development

我登录 postgres 并执行了这些命令.

I log into postgres and did these commands.

psql postgres
CREATE USER root
CREATE DATABASE svp-chicago_development
GRANT ALL PRIVILEGES ON DATABASE svp-chicago_development to root
ALTER DATABASE svp-chicago_development OWNER TO root

当我执行 \list 时,我看到数据库在那里.

When I do \list I see the database is there.

推荐答案

我猜你没有为你的 user 创建 password.尝试按如下方式创建密码:

I guess you missed create password for your user. Try to create password as following:

CREATE USER root WITH PASSWORD 'your_new_password';
CREATE DATABASE svp-chicago_development;
GRANT ALL PRIVILEGES ON DATABASE svp-chicago_development to root;
ALTER DATABASE svp-chicago_development OWNER TO root;

这篇关于Rails:PG::InsufficientPrivilege:错误:关系 schema_migrations 的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆