[PostgreSQL][RDS][localhost]特定ユーザーの作成とDB作成

LINEで送る
Pocket

  • 特定ユーザーのみ作成
CREATE ROLE hoge-user WITH PASSWORD 'xxxxxxxx' NOSUPERUSER NOCREATEDB NOCREATEROLE LOGIN;
  • 特定ユーザーとそれに伴うDBの作成
CREATE ROLE hogehoge WITH PASSWORD 'xxxxxxxx' NOSUPERUSER NOCREATEDB NOCREATEROLE LOGIN;

GRANT hogehoge TO root;

CREATE DATABASE hoge_db WITH OWNER hogehoge;

- digdagの場合
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
  • localhostの場合
$ sudo su - postgres
$ createuser --pwprompt --interactive pgadmin
$ psql -h localhost -U pgadmin -d postgres
 
CREATE ROLE digdag WITH PASSWORD 'xxxxxxxx' NOSUPERUSER NOCREATEDB NOCREATEROLE LOGIN;
GRANT digdag TO pgadmin;
CREATE DATABASE digdag WITH OWNER digdag;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

 

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *