Skip to content

Instantly share code, notes, and snippets.

@caifara
Last active April 25, 2016 14:33
Show Gist options
  • Save caifara/e17732e28da7928712eb4ef91cd4b110 to your computer and use it in GitHub Desktop.
Save caifara/e17732e28da7928712eb4ef91cd4b110 to your computer and use it in GitHub Desktop.
upgrading postgres
# originally installed through official "visual installer"
# 1 install new version with same visual installer
# 2 stop server
$> sudo launchctl unload /Library/LaunchDaemons/com.edb.launchd.postgresql-9.1.plist
# 3 ease passwordcontrol
# Edit pg_hba.conf in old and new server, example:
$> sudo nvim /Library/PostgreSQL/9.3/data/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
local all postgres trust
# 4 upgrade
# ! as postgres user
$> cd /tmp
$> sudo -H -u postgres /Library/PostgreSQL/9.3/bin/pg_upgrade -b /Library/PostgreSQL/9.1/bin -B /Library/PostgreSQL/9.3/bin -d /Library/PostgreSQL/9.1/data -D /Library/PostgreSQL/9.3/data
# 5 restore password permissions
# 6 set port if necessary
# used to be 5432
$> sudo nvim /Library/PostgreSQL/9.3/data/postgresql.conf
# 7 run upgrade software
# upgrade may have some printed some info and generated new files to run, check it
# 8 start service again
$> sudo launchctl load /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment