Skip to content

Instantly share code, notes, and snippets.

@colbypalmer
Last active August 29, 2015 14:02
Show Gist options
  • Save colbypalmer/9f8010191af55a3a7bd2 to your computer and use it in GitHub Desktop.
Save colbypalmer/9f8010191af55a3a7bd2 to your computer and use it in GitHub Desktop.
List of useful Postgres commands
# Create database and user
CREATE DATABASE test_database;
CREATE USER tester WITH PASSWORD 'test_password';
GRANT ALL PRIVILEGES ON DATABASE "test_database" to tester;
# List all users
\du
# Delete a user with existing privileges
DROP OWNED BY <username>;
DROP USER <username>;
# Delete database
DROP DATABASE <db_name>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment