import server list between pgadmin 4
According to https://stackoverflow.com/a/45823367/89346, configuration data seems to be available in C:\Users\{Your_User}\AppData\Roaming\pgAdmin
. You may try to copy the pgAdmin
directory across different machines
Documentation exists for this, here: Exporting and importing Servers
When you install pgAdmin4 on Windows, e.g. C:\Program Files (x86)\pgAdmin 4\v4 for version pgAdmin4 v4.2 in my case, there is a subfolder named venv which hosts another Scripts subfolder in which is stored Python Virtual Environment mentioned in documentation.
This is the python.exe that we can use to dump the servers list. Open a command prompt (Win + R, cmd), and browse to this Scripts subdirectory
cd "C:\Program Files (x86)\pgAdmin 4\v4\venv\Scripts"
The command I used to create the dump is:
python.exe "C:\Program Files (x86)\pgAdmin 4\v4\web\setup.py" --dump-servers D:\dump\pgAdmin4_servers_list.json
If successful, message stating number of servers descriptions dumped will be displayed. In my case:
Configuration for 43 servers dumped to D:\dump\pgAdmin4_servers_list.json.
Then, copy the JSON file to the new computer and, using a command prompt, browse to the same subdirectory as before:
cd "C:\Program Files (x86)\pgAdmin 4\v4\venv\Scripts"
Before import, make sure pgAdmin4 server is shutdown. Now you can import the JSON file content (E: is my flash drive letter):
python.exe "C:\Program Files (x86)\pgAdmin 4\v4\web\setup.py" --load-servers E:\dump\pgAdmin4_servers_list.json
If successful, it should display the number of server groups and servers added. In my case:
Added 5 Server Group(s) and 43 Server(s).
Restart pgAdmin4 and you should see your server list as it was on the source.