使用pgloader将MySQL迁移到PostgreSQL

4

我正在尝试使用pgloader将mysql迁移到postgres,由于我在使用Windows操作系统,因此我在Windows Linux子系统中安装了pgloader,并使用以下命令迁移数据库: 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了。
1个回答

4

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

命令行:

pgloader SOURCE TARGET

源连接字符串

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

db可能是sqlite、mysql或mssql。

连接字符串

参数应该以连接URI的形式提供,具体文档见PostgreSQL文档中的http://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNSTRING

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

用户

可以包含任何字符,包括冒号(:),但必须将其加倍(::),以及“@”符号,也必须加倍(@@)。

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

密码

可以包含任何字符,包括“@”符号,但必须将其加倍(@@)。若要将密码保留为空白,请在用户名以“@”符号结尾时使用以下语法:user:@。

如果省略,则密码默认为PGPASSWORD环境变量的值(如果已设置),否则密码保持未设置状态。

当连接URI和环境中都找不到密码时,pgloader会查找 .pgpass 文件,该文件在https://www.postgresql.org/docs/current/static/libpq-pgpass.html中有说明。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接