How to copy PostgreSQL database to server from local computer

Viewed 149

I am trying to copy PostgreSQL database from my computer to Ubuntu 20.04 server. Also, a python script with a database is running on the server using docker-compose. I enter this command on my computer:

pg_dump -C -h localhost -U steamtrader_pguser steamtrader | psql -h *server IP* -U steamtrader_pguser steamtrader

but I get errors:

psql: error: FATAL:  password authentication failed for user "steamtrader_pguser"
pg_dump: error: could not write to output file: Broken pipe

The PostgreSQL account on the server and on my computer have the same username, password and database name. But when I enter the password, I get an error that it is incorrect. I also get errors on the server side:

FATAL:  password authentication failed for user "steamtrader_pguser"
DETAIL:  Password does not match for user "steamtrader_pguser"
Connection matched pg_hba.conf line 94: "host all all 0.0.0.0/0 md5"

I enter the command on my computer while the database script is running on the server. If I stop the script but leave the server running, I get the following error when I issue the command:

Password: psql: error: could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "18.188.219.232" and accepting
    TCP/IP connections on port 5432?

I'm new to this topic, so I would really appreciate your help!

0 Answers
Related