“[Errno 2] No such file or directory” when trying to backup a database in pgAdmin4

别说谁变了你拦得住时间么 提交于 2019-12-01 06:41:16

I just updated to pgAdmin v4.1 and this solved the issue :-) Thanks all for helping!

I solved the problem through the command line.

If we use a previous format, it has the same response as you had:

$ pg_restore -d <DBNAME> --username=postgres g=<FILENAME> 
pg_restore: [archiver] could not open input file "g=<FILENAME>": No such file or directory

If we change the last param, it works properly:

$ pg_restore -d <DBNAME> --username=postgres <FILENAME>

I suppose the GUI-command changed in v4, but the console pg_restore is not.

Enter only a filename, no path, because pgadmin puts the backup in its own directory, specifically, in ~/.pgadmin/storage/(user).

I suspect that path for "PostgreSQL Binary Path" is not set properly in pgAdmin4.

pgAdmin4 is Web application and pgAdmin3 is Desktop application, So pgAdmin4 needs to know path of utilities like pg_dump & pg_restore binaries so that it can execute them.

In pgAdmin4 Goto: File > Preferences > Paths > Binary paths > PostgreSQL Binary Path

If you are using Windows than provide path like, C:\Program Files\PostgreSQL\9.6\bin

If you are using Linux than provide path like, /opt/PostgreSQL/9.5/bin

user@mint:/opt/PostgreSQL/9.5/bin$ lsh pg_du* pg_res*
-rwxr-xr-x 1 xxx xxx 150K Sep  2  2015 pg_restore
-rwxr-xr-x 1 xxx xxx  49K Sep  2  2015 pg_resetxlog
-rwxr-xr-x 1 xxx xxx  83K Sep  2  2015 pg_dumpall
-rwxr-xr-x 1 xxx xxx 364K Sep  2  2015 pg_dump

You need to give absolute path with the file name to sql file like below.

Windows

C:/test/test.sql

Linux

/u01/test.sql

Roland Hardt

On MacOS 10.11 and using postgres.app I resolved it this way:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!