如何解决PGAdmin4备份数据库时pg_dump.exe路径错误且修改后自动变更的问题
pg_dump.exe I’ve run into this exact frustrating issue before—PGAdmin keeps appending the executable name twice because of a misconfigured binary path. Here’s how to fix it step by step:
1. Correct the Binary Path in Preferences (The Right Way)
The core problem is you’re probably setting the path to the pg_dump.exe file directly, but PGAdmin expects the parent bin directory (it auto-adds the executable names on its own).
- Open PGAdmin4, go to
File > Preferences > Paths > Binary Paths - For your PostgreSQL 14 entry, set the path to:
Do NOT includeC:\Program Files\PostgreSQL\14\bin\pg_dump.exeat the end—that’s exactly why you’re getting the duplicatepg_dump.exe\pg_dump.exeerror. - Click
Saveand restart PGAdmin4 to test if the backup works.
2. Manually Edit the PGAdmin Config File (If GUI Settings Won’t Stick)
Sometimes permission issues or corrupted configs prevent PGAdmin from saving your preferences. Here’s how to edit the config directly:
- Close PGAdmin4 completely.
- Open File Explorer and navigate to:
%APPDATA%\pgAdmin - Open the
pgAdmin4.conffile with a text editor (like Notepad++ or even plain Notepad). - Look for lines starting with
BinaryPaths—you’ll likely see something broken like:BinaryPaths={'PostgreSQL 14': 'C:\\Program Files\\PostgreSQL\\14\\bin\\pg_dump.exe'} - Modify it to point only to the
bindirectory:BinaryPaths={'PostgreSQL 14': 'C:\\Program Files\\PostgreSQL\\14\\bin'} - Save the file, then restart PGAdmin4. Your path should stay correct now.
3. Fix Permission Issues
If the config keeps reverting even after editing the file, PGAdmin might not have permission to save changes:
- Right-click your PGAdmin4 shortcut and select Run as administrator.
- Go back to the Binary Path preferences, set the correct
bindirectory, save, and restart. - This ensures PGAdmin can write to its config files without restrictions.
4. Reinstall PGAdmin4 (Last Resort)
If none of the above works, a corrupted installation might be the culprit:
- Uninstall PGAdmin4 from
Settings > Apps > Apps & features. - Download the latest compatible version of PGAdmin4 (match your PostgreSQL 14 version) from the official PostgreSQL website.
- During installation, when prompted to set binary paths, make sure to select the
C:\Program Files\PostgreSQL\14\bindirectory, not the executable file.
内容的提问来源于stack exchange,提问作者Labaks.

