Last active
June 21, 2016 16:42
-
-
Save bf/c545ed5b817e113505f7b1fb302b6ab2 to your computer and use it in GitHub Desktop.
PostgreSQL: Create new User and Database
This file contains hidden or 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
# To create a new postgres database with a new user/password combination | |
# we first have to log in as the postgres user | |
sudo su - postgres; | |
# now we are the "postgres" user which is allowed to create new database users | |
# we use the -P parameter to create a new user called "annie". Annie uses a password. | |
createuser -P annie; | |
# finally, we create Annie's database | |
createdb -O annie annies_database; | |
# in the end we exit the postgres user's shell and | |
# we become ourselves again | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment