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