Skip to content

Instantly share code, notes, and snippets.

@sethcall
Created July 14, 2012 20:06
Show Gist options
  • Save sethcall/3113108 to your computer and use it in GitHub Desktop.
Save sethcall/3113108 to your computer and use it in GitHub Desktop.
first time postgres database creation made easy
# first create a user in the database that is your current username (answer 'y' for superuser if this is a development machine.)
sudo su postgres -c "createuser seth"
# create a database of the same name, so that just typing 'psql' will drop you into the psql command-line against database 'seth'
sudo su postgres -c "createdb seth --owner seth"
# now you don't need to sudo for any subsequest pg commands, if you are logged in as this user, for example:
initdb /var/lib/pgsql91/data
createdb "test_this"
psql test_this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment