pg_dump server version mismatch 14.04 talking to AWS RDS

This is a pretty basic one. You’re on an older ubuntu and you want to use pg_dump to backup a database from RDS.

You end up with this great message:

Mon Jul 25 16:51:35 EDT 2016 – Dumping production DB
pg_dump: server version: 9.4.5; pg_dump version: 9.3.10
pg_dump: aborting because of server version mismatch
Mon Jul 25 16:51:35 EDT 2016 – Done

The easiest way to fix this for was to just upgrade postgresql even though I didn’t need it on the local server.  (if you know a way,let me know).

To upgrade postgres on Ubuntu 14.04 I followed this handy guide at howtoforge

At this point, you’re still going to have issues because the pg_dump binary is pointing at the wrong thing.  To fix this, I went into /usr/bin and deleted the pg_dump from there.  Then I did a created a symlink to the more recent pg_dump.

sudo ln -s /usr/lib/postgresql/9.5/bin/pg_dump 

Now running pg_dump –version should output:

⚡ pg_dump –version
pg_dump (PostgreSQL) 9.5.3