3

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

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

4

1 回答 1

0

来自 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 环境变量的值。

密码

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

省略时,如果设置了密码,则默认为 PGPASSWORD 环境变量的值,否则未设置密码。

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

于 2021-01-27T21:47:52.947 回答