Basic with Postgresql

For psql command line, We'll start with


>>> psql


Create User


psql::CREATE USER joe;
psql::ALTER ROLE joe PASSWORD 'secret_password';


Or


psql::CREATE USER username WITH PASSWORD 'xxxxx';


Or


Create an account where the user can create db;
psql::CREATE USER username WITH PASSWORD 'xxxxx' CREATEDB;


Give him a right on superuser


psql::ALTER ROLE joe WITH CREATEDB;
psql::ALTER ROLE joe WITH SUPERUSER;


Create Database


psql::CREATE DATEBASE mydb;


Or


psql::CREATE DATABASE dbname OWNER rolename;


Grant all available privileges to user


psql::GRANT ALL PRIVILEGES ON mydb TO joe;


psql::GRANT admins TO joe;

Comments

Popular posts from this blog

Return Code 127