feat(postgres): add commands and password file

This commit is contained in:
Michele Cereda
2024-07-03 20:11:05 +02:00
parent 4918a0888e
commit 8cad36a548
3 changed files with 32 additions and 5 deletions

View File

@@ -27,9 +27,11 @@ CREATE DATABASE world;
SELECT * FROM pg_settings;
SELECT "name", "setting" FROM pg_settings WHERE NAME LIKE '%log%';
SHOW "wal_keep_size";
SHOW "password_encryption";
-- Change database settings for the current session
SET pgaudit.log = 'none';
SET password_encryption = 'scram-sha-256';
-- Change database settings permanently
ALTER DATABASE reviser SET pgaudit.log TO 'none';
@@ -61,6 +63,8 @@ DROP SCHEMA IF EXISTS mundane CASCADE;
-- List users with respective roles
\du
\du+
-- List users only
select usename FROM pg_catalog.pg_user;
-- Check the current user has SuperUser permissions
SHOW is_superuser
@@ -72,6 +76,8 @@ ALTER USER joel WITH SUPERUSER;
ALTER USER joel WITH NOSUPERUSER;
-- Allow users to create databases
ALTER USER mark CREATEDB;
-- Change passwords
ALTER USER jonathan WITH PASSWORD 'seagull5-pantomime-Resting';
-- Close the connection to the current DB
@@ -79,6 +85,10 @@ ALTER USER mark CREATEDB;
\quit
-- Get passwords
SELECT rolpassword from pg_authid where rolname = 'admin';
-- Show extensions
\dx
SELECT * FROM pg_extension;