Skip to content

Instantly share code, notes, and snippets.

@stephenlacy
stephenlacy / how to make a new db in posgres.sql
Created January 16, 2025 22:25
because I need to google this each time...
-- Create the database
CREATE DATABASE your_database_name;
-- Create the user with a password
CREATE USER your_username WITH PASSWORD 'your_password';
-- Grant all current and future permissions on the database to the user
GRANT ALL PRIVILEGES ON DATABASE your_database_name TO your_username;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO your_username;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO your_username;