I’m facing issues trying to backup my production database. This is the step I’m following:
1: Open a Command-line window where you launched your app (e.g., c:\moon). Type:
fly proxy 15432:5433 -a moon-db
2: Open a new Command-line window of the same directory. Type:
pg_dump -p 15432 -h localhost -U postgres -c -d moon -f db_backup
It will prompt you for password. I’m using the password from my DATABASE_URL env variable that have this format:
I’m using the password as
XXXXXXXXXXXX (I’m hiding it)
And then receive this error message in the terminal:
pg_dump: error: connection to database "moon" failed: FATAL: password authentication failed for user "postgres"
Can you help me to see what is wrong in the process? And if the password isn’t in the DATABASE_URL, where can I find it?
Can you retry this with
-U moon instead
postgres since the password you provided corresponds to that user?
I tried, now apper a new error related the version of pg_dump:
pg_dump: error: server version: 14.4 (Debian 14.4-1.pgdg110+1); pg_dump version: 12.11 (Ubuntu 12.11-0ubuntu0.20.04.1) pg_dump: error: aborting because of server version mismatch
Do you know how can I solve it?
Already solved. The problem was related to my local postgresql version. I updated it for my Ubuntu system with this commands:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-14
After it run the command again and worked.
April 29, 2023, 4:40pm
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.