pg_dump with dbname - 端口号无效?
pg_dump with dbname - invalid port number?
将 dbname
参数与 pg_dump.exe
一起使用时,出现以下错误:
错误:
pg_dump: [archiver (db)] connection to database "my_database" failed:
invalid port number:
"mypass@my_server.postgres.database.azure.com:5432/my_database"
命令:
pg_dump.exe --dbname=postgresql://my_user@my_server:mypass@my_server.postgres.database.azure.com:5432/my_database
我认为这是由于用户名中的“@”所致。但是没有提供 server/host,我得到这个:
pg_dump: [archiver (db)] connection to database "my_database" failed: FATAL: Invalid Username specified. Please check the
Username and retry connection. The Username should be in format.
FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in format.
尝试连接字符串(使用 urlencoded 值代替 @
),例如:
t=# create user "us@r" password 'a@a';
CREATE ROLE
t=# grant CONNECT ON DATABASE t TO "us@r";
GRANT
t=# grant all on a to "us@r";
GRANT
t=# \! pg_dump -d "postgres://us%40r:a%40a@localhost:5432/t" -t a -s | head -n 3
--
-- PostgreSQL database dump
--
将 dbname
参数与 pg_dump.exe
一起使用时,出现以下错误:
错误:
pg_dump: [archiver (db)] connection to database "my_database" failed: invalid port number: "mypass@my_server.postgres.database.azure.com:5432/my_database"
命令:
pg_dump.exe --dbname=postgresql://my_user@my_server:mypass@my_server.postgres.database.azure.com:5432/my_database
我认为这是由于用户名中的“@”所致。但是没有提供 server/host,我得到这个:
pg_dump: [archiver (db)] connection to database "my_database" failed: FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in format. FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in format.
尝试连接字符串(使用 urlencoded 值代替 @
),例如:
t=# create user "us@r" password 'a@a';
CREATE ROLE
t=# grant CONNECT ON DATABASE t TO "us@r";
GRANT
t=# grant all on a to "us@r";
GRANT
t=# \! pg_dump -d "postgres://us%40r:a%40a@localhost:5432/t" -t a -s | head -n 3
--
-- PostgreSQL database dump
--