postgresql create user and grant all privileges code example
Example 1: grant all privileges database postgres to user
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema_name TO username;
Example 2: postgres create user with superuser privileges
sudo -u postgres createuser -s -i -d -r -l -w <<username>>
sudo -u postgres psql -c "ALTER ROLE <<username>> WITH PASSWORD '<<password>>';"