mysqlpostgresqlubuntucommand-promptpgloader

Migrate mysql to postgres using pgloader


I'm trying to migrate mysql to postgres using pgloader, since I'm using window so, I installed pgloader in windows linux subsystem, and I have used following command to migrate the DB pgloader mysql://root@localhost/f1db pgsql://postgres@localhost:5433/f1db

    KABOOM!
FATAL error: Failed to connect to pgsql at "localhost" (port 5433) as user "postgres": Server requested md5-password authentication, but no password was given.
An unhandled error condition has been signalled:
   Failed to connect to pgsql at "localhost" (port 5433) as user "postgres": Server requested md5-password authentication, but no password was given.




What I am doing here?

Failed to connect to pgsql at "localhost" (port 5433) as user "postgres": Server requested md5-password authentication, but no password was given.


Waiting for the monitor thread to complete.

Please tell that how to pass password for both MYsql and Postgres in the command line and if I have @ in my password how to use it in the command because we already have user@localhost in the command.


Solution

  • From pgloader Reference Manual (https://pgloader.readthedocs.io/en/latest/pgloader.html):

    command line:

    pgloader SOURCE TARGET
    

    Source Connection String

    db://user:pass@host:port/dbname
    

    Where db might be of sqlite, mysql or mssql.

    Connection String

    The parameter is expected to be given as a Connection URI as documented in the PostgreSQL documentation at http://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNSTRING.

    postgresql://[user[:password]@][netloc][:port][/dbname][?option=value&...]
    

    user

    Can contain any character, including colon (:) which must then be doubled (::) and at-sign (@) which must then be doubled (@@).

    When omitted, the user name defaults to the value of the PGUSER environment variable, and if it is unset, the value of the USER environment variable.

    password

    Can contain any character, including the at sign (@) which must then be doubled (@@). To leave the password empty, when the user name ends with at at sign, you then have to use the syntax user:@.

    When omitted, the password defaults to the value of the PGPASSWORD environment variable if it is set, otherwise the password is left unset.

    When no password is found either in the connection URI nor in the environment, then pgloader looks for a .pgpass file as documented at https://www.postgresql.org/docs/current/static/libpq-pgpass.html