Skip to content

Instantly share code, notes, and snippets.

@jeanlescure
Last active May 14, 2018 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeanlescure/632481d3a473b8d731ffb2954ce16261 to your computer and use it in GitHub Desktop.
Save jeanlescure/632481d3a473b8d731ffb2954ce16261 to your computer and use it in GitHub Desktop.
# Misc operations I use in OSX for PostgreSQL management
# Install brew and postgres
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install postgresql
postgres -V
# If password lost just change 'md5' to 'trust' for all users in following file
sudo vim /Library/PostgreSQL/10.x/data/pg_hba.conf
# Start/stop the daemon
brew services start postgresql
brew services stop postgresql
# Run sql file as current user (i.e. jeanlescure)
psql -d database -a -f databse.sql
# Run sql file as postgres user
psql -U postgres -d database -a -f databse.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment