postgres用户创建与密码设置

postgres安装完成后使用psql命令进入控制台(默认无需密码)
使用\password命令,为postgres用户设置一个密码

\password postgres

创建数据库用户rails_payment,并设置密码。
CREATE USER rails_payment WITH PASSWORD ‘rails_payment’;

ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: permission denied to create database


Lisas-Mac-2:~ postgres$ psql
psql (9.6.1)
Type "help" for help.

postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# CREATE USER rails_payment WITH PASSWORD 'rails_payment';
CREATE ROLE
postgres=# CREATE DATABASE payment_dev OWNER rails_payment;
CREATE DATABASE
postgres=# CREATE DATABASE payment_test OWNER rails_payment;
CREATE DATABASE
postgres=# CREATE DATABASE payment_pro OWNER rails_payment;
CREATE DATABASE
    原文作者:李小西033
    原文地址: https://www.jianshu.com/p/8e292615b9a4
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞