使用 pgloader 迁移 mysql 到 postgres

Migrate mysql to postgres using pgloader

我正在尝试使用 pgloader 将 mysql 迁移到 postgres,因为我正在使用 window 所以,我安装了 pgloader windows linux 子系统,我使用以下命令迁移数据库 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.

请告诉我如何在命令行中为 MYsql 和 Postgres 传递密码,如果我的密码中有 @ 如何在命令中使用它,因为我们已经在命令中有 user@localhost .

来自 pgloader 参考手册 (https://pgloader.readthedocs.io/en/latest/pgloader.html):

命令行:

pgloader SOURCE TARGET

源连接字符串

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

其中 db 可能是 sqlite,mysql 或 mssql。

连接字符串

该参数应作为连接 URI 给出,如 http://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNSTRING 处的 PostgreSQL 文档中所述。

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

用户

可以包含任何字符,包括必须加倍 (::) 的冒号 (:) 和必须加倍 (@@) 的符号 (@)。

省略时,用户名默认为PGUSER环境变量的值,如果未设置,则为USER环境变量的值。

密码

可以包含任何字符,包括必须加倍 (@@) 的 at 符号 (@)。要将密码留空,当用户名以 at 符号结尾时,您必须使用语法 user:@.

省略时,密码默认为 PGPASSWORD 环境变量的值(如果已设置),否则不设置密码。

当在连接 URI 或环境中均未找到密码时,pgloader 将查找 https://www.postgresql.org/docs/current/static/libpq-pgpass.html

中记录的 .pgpass 文件