Last active
August 29, 2015 14:02
-
-
Save colbypalmer/9f8010191af55a3a7bd2 to your computer and use it in GitHub Desktop.
List of useful Postgres commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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