0

I've been running pgcli for some time and have just started trying to back-up my database. I've tried running pg_dump, but have been having various problems. When I enter this into the CLI:

pg_dump --version

I get the response:

bash: /usr/bin/pg_dump: No such file or directory

I've tried installing postgresql-client, as per:

sudo apt-get install postgresql-client

and

sudo apt-get install postgresql-client-common

But I get the same results whenever I try to use the pg_dump command. I don't know where to begin to resolve this.

(I've picked up the above ideas from previous stack threads, eg: what is the meaning of the pg_dump and pg_restore errors)

JimmyTheCode
  • 3,783
  • 7
  • 29
  • 71
  • Postgres version? Where did you get the Postgres packages to begin with and how did you install them? Do you have more then instance of Postgres installed? What does `whereis pg_dump` show? – Adrian Klaver Jan 01 '21 at 18:06
  • What does `which -a pg_dump` show? – jjanes Jan 02 '21 at 02:04
  • /usr/bin/pg_dump @jjanes (sorry for the delay. I had to re-install postgresql as I'd broken something. Been trying to figure things out since) – JimmyTheCode Jan 04 '21 at 15:15
  • @AdrianKlaver, (This is probably a moot point now, because I've removed and reinstalled postgresql - ```whereis pg_dump``` returns: ```pg_dump: /usr/bin/pg_dump /usr/share/man/man1/pg_dump.1.gz``` I've also tried: ```psql --version``` returns: ```psql (PostgreSQL) 13.1 (Ubuntu 13.1-1.pgdg18.04+1)``` Although, ```pg_dump --version``` returns: ```pg_dump (PostgreSQL) 10.15 (Ubuntu 10.15-1.pgdg18.04+1)``` – JimmyTheCode Jan 04 '21 at 15:18
  • So is it working? – Adrian Klaver Jan 04 '21 at 15:42
  • It's solved the problem I had where I got "No such file or directory". I'm now back trying to figure out my original problem, which is that I get this message: ```server version: 12.5 (Ubuntu 12.5-1.pgdg16.04+1); pg_dump version: 10.15 (Ubuntu 10.15-0ubuntu0.18.04.1) ```. I've tried to update my postgresql, but I seem to now have two versions of pg_dump on file: ```/usr/lib/postgresql/12/bin/pg_dump``` , and ```/usr/lib/postgresql/10/bin/pg_dump```. Every time I try to use pg_dump, it reverts to version 10. Trying to figure out why/how to get it to use the version 12 I have installed. – JimmyTheCode Jan 04 '21 at 15:59

0 Answers0