how to update pg_dump to server version in Mac OS
Asked Answered
U

4

20

I'm trying to backup a local database in my laptop (PostGresSQL 9.6 ,PgAdmin3) and I see the following error.

pg_dump: server version: 9.6.3; pg_dump version: 9.5.5 pg_dump: aborting because of server version mismatch

I've tried some answers on SO, like updating the postgres on homebrew but it threw an error as well.

Error: postgres not installed

When I checked the contents of postgres application package, I found 2 folders in the versions folder, 9.5 and 9.6. I tried running the pg_dump in the bin folder of both the versions and all I see is this error:

enter image description here

Can someone help me to solve this problem and make a backup of my database

Underhill answered 11/7, 2017 at 4:25 Comment(0)
H
15

Resurfaced when our server got to postgresql 13.8 and locally I was on 12

Uninstall the old postgresql version and install a new one. Start & stop postgres services too. On Mac:

brew install postgresql@13 # install server version or higher
brew services stop postgresql@12 # stop postgres
brew uninstall postgresql@12 # uninstall old version
brew services start postgresql@13 # start newly installed version

Double check the version in use: psql --version

Get info on postgresql versions installed via brew: brew info postgresql@13

Hopper answered 7/11, 2022 at 20:34 Comment(1)
uninstalling the old version specifically did it for me.Neper
M
4

If using brew on MacOS brew install [email protected] Homebrew install specific version of formula?

Stop postgres

brew services stop postgresql

Upgrade with Homebrew

brew update
brew upgrade postgresql

Check Version:

psql --version
> psql (PostgreSQL) 10.3
Maryland answered 21/3, 2020 at 22:35 Comment(0)
S
3

MACOS M2 solution:

➜ ~ brew link postgresql@16 --force

if it is already linked, run before: ➜ ~ brew unlink postgresql@14

Selflove answered 14/5 at 15:3 Comment(0)
D
-2

I found this one more helpful than above. It has upgraded the DB without any issue. https://quaran.to/Upgrade-PostgreSQL-from-12-to-13-with-Homebrew

brew services stop postgresql
brew postgresql-upgrade-database
brew services start postgresql
Demmer answered 2/6, 2021 at 12:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.