Skip to content

Instantly share code, notes, and snippets.

@pen-pal
Created February 3, 2025 07:36
Show Gist options
  • Save pen-pal/fc7936a9a5c4bdea94f248171e1978f4 to your computer and use it in GitHub Desktop.
Save pen-pal/fc7936a9a5c4bdea94f248171e1978f4 to your computer and use it in GitHub Desktop.
postgresql-user-and-db-create.sh
CREATE DATABASE test;
CREATE USER test WITH PASSWORD 'test';
GRANT ALL PRIVILEGES ON DATABASE test TO test;
\c test
GRANT ALL PRIVILEGES ON SCHEMA public TO test;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO test;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO test;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO test;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment