2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-01 21:40:24 +00:00
cheat.sheets/sheets/_psql/users

12 lines
234 B
Plaintext
Raw Normal View History

2018-01-17 16:13:38 +00:00
-- List roles
2018-01-07 11:42:08 +00:00
SELECT rolname FROM pg_roles;
2018-01-17 16:13:38 +00:00
-- Create user
2018-01-07 11:42:08 +00:00
CREATE USER <user_name> WITH PASSWORD '<password>';
2018-01-17 16:13:38 +00:00
-- Drop user
2018-01-07 11:42:08 +00:00
DROP USER IF EXISTS <user_name>;
2018-01-17 16:13:38 +00:00
-- Alter user password
2018-01-07 11:42:08 +00:00
ALTER ROLE <user_name> WITH PASSWORD '<password>';