W
W
WhatIsHTML2018-03-27 21:07:09
PostgreSQL
WhatIsHTML, 2018-03-27 21:07:09

How to transfer a database dump from Ubuntu to Windows?

There is Ubuntu with postgresql database. It is necessary to transfer the same base to Windows. On Ubuntu I did a dump like this:

sudo su - postgres
pg_dump postgres > postgres_db.sql

On Windows I import like this:
"C:\Program Files\PostgreSQL\10\bin\psql.exe" test < "E:\\Shared\\backup.sql"

You must then enter a password. I enter the password and get an error
psql: ВАЖНО:  пользователь "User" не прошёл проверку подлинности (по паролю)

spoiler
5aba87d79b430322238671.png

I don't understand why. First, it is not clear which user's password is requested? There were no passwords on Windows. So the password is from ubuntu, but there is an administrator password, and there is a postgresql user password. In any case, neither one nor the other password is suitable. How can I import a dump into a database on Windows? Help, just a cry from the heart.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Roo, 2018-03-27
@WhatIsHTML

https://stackoverflow.com/questions/9736085/run-a-...

M
Melkij, 2018-03-27
@melkij

It has nothing to do with any source database passwords.
The question is solely about setting up your base in this exotic windows environment.
The one you told psql to connect to. Since you didn't specify the appropriate -U switch, and most likely didn't define an environment variable, psql tries to use the same username as the open console username.
The error said in plain text that password authentication was used, as a result, there was no user with such a password in the database. Figure out how to log in to the database in your system, it has nothing to do with dumps.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question