postgresql 创建扩展“uuid-ossp”的权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22135792/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:20:12  来源:igfitidea点击:

permission denied to create extension "uuid-ossp"

ruby-on-railspostgresql

提问by User314159

I'm building a Rails project on postgresql, but when I

我正在 postgresql 上构建一个 Rails 项目,但是当我

rake db:migrate

I get the following error:

我收到以下错误:

 permission denied to create extension "uuid-ossp"

Here's how my database.yml looks like:

这是我的 database.yml 的样子:

app_common: &app_common
adapter: postgresql
host: 127.0.0.1
port: 5432
encoding: unicode
pool: 5
username: root
password:

回答by User314159

Figured it out, I need to postegresql and change the root role to superuser:

想通了,我需要 postegresql 并将 root 角色更改为超级用户:

$psql

ALTER USER root WITH SUPERUSER;

回答by Maged Makled

ALTER USER root WITH SUPERUSERif the user of the database was rootbut in case it wasn't, you need to run psql as a superuser first before you run this command so you run

ALTER USER root WITH SUPERUSER如果数据库的用户是,root但如果不是,则需要先以超级用户身份运行 psql,然后再运行此命令,以便运行

sudo -u postgres psql postgres

sudo -u postgres psql postgres

then

然后

ALTER USER mydb_user WITH SUPERUSER;

ALTER USER mydb_user WITH SUPERUSER;

回答by ankit

solution:

解决方案:

  1. ALTER USER root WITH SUPERUSER;

    OR

  2. using PGADMIN, Steps:

    localhost-> Login Role-> Right click role i.e. postgres-> ** in Role privileges tab** -> check SuperUser-> OK.

  1. ALTER USER root WITH SUPERUSER;

    或者

  2. 使用PGADMIN,步骤:

    localhost->登录角色->右键单击角色,即 postgres-> ** 在角色权限选项卡** ->检查 SuperUser-> OK

SS

SS

Enjoy.

享受。