Search code examples
postgresqlpgloader

Pgloader can't connect to PostgreSQL database


I'm trying to transfer a MySQL database to a PostgreSQL database using pgloader. I'm using Windows 11, PostgreSQL 16 and pgloader 3.6.3. Both databases are on my computer and pgloader is installed in WSL (Ubuntu). When I try to run this command:

pgloader mysql://root@localhost:3306/mysqlDB pgsql://postgres:myPassword@localhost:5432/postgresDB

I get this error message from pgloader:

KABOOM!
FATAL error: Failed to connect to pgsql at "localhost" (port 5432) as user "postgres": Database error 28P01: password authentication failed for user "postgres"
An unhandled error condition has been signalled:
   Failed to connect to pgsql at "localhost" (port 5432) as user "postgres": Database error 28P01: password authentication failed for user "postgres"
What I am doing here?
Failed to connect to pgsql at "localhost" (port 5432) as user "postgres": Database error 28P01: password authentication failed for user "postgres"

I'm sure the password for postgres is correct because it is the same password I use to access the database from pgadmin 4.

I tried to change the authentication method in pg_hba.conf to "trust" but that hasn't worked.

Any help would be greatly appreciated.


Solution

  • I solved the problem, I was using localhost when I should have used the IP address of my computer.