13

I installed PostgreSql on my Windows machine. I can connect to PostgreSql through cmd. But when I want to launch pgAdmin I am getting this error message.

Failed to connect to the pgAdmin application server. Click here to try again.

I have also Mysql installed on my machine if it can make any complications.

9
  • How exactly are you accessing/starting pgAdmin?
    – user330315
    Oct 17, 2016 at 10:00
  • pg_ctl start -D D:\Postgresql\data
    – LucasPG
    Oct 17, 2016 at 10:24
  • 2
    That starts the Postgres server, not the pgAdmin server
    – user330315
    Oct 17, 2016 at 10:24
  • I added exceptions to my firewall and still same problem
    – LucasPG
    Oct 17, 2016 at 10:25
  • 1
    By launching pgAdmin.exe as administrator
    – LucasPG
    Oct 17, 2016 at 10:26

8 Answers 8

38

The same problem happened to me today:

enter image description here

And this is how I've solved it:

1) Use a text editor to open the config_distro.py file under the c:\Program Files\pgAdmin 4\v1\web folder. Change the value for SERVER_MODE from True to False, then save the change. (I have run Notepad++ as an Administrator, in order to be able to save in this protected folder.)

enter image description here

2) Go to folder c:\Users\your_name\AppData\Roaming\pgAdmin and make sure there is nothing there (delete all the files, as they are temporary and will be restored after starting pgAdmin)

enter image description here

3) Start pgAdmin

enter image description here

4) This time you will see a white box that sits - at least, on my slow laptop - about 20 seconds. (You may briefly see the original error message, but do not worry).

enter image description here

5) Meanwhile, the temporary files - required for running the application - are created.

enter image description here

6) Once the temporary files process is over, the application starts as expected.

enter image description here

1
  • Thank you very much for your thorough explanation (+1) from me :)
    – Christos
    Dec 9, 2016 at 20:00
9

Try starting the pgAdmin as administrator.

0
3

My config_distro.py was missing this line:

MINIFY_HTML=False

I added it as in the above steps and it works

1
  • You sir, deserve a nobel
    – leoschet
    Feb 10, 2019 at 22:01
2

In my case, SERVER_MODE was already False in config_distro.py. I then proceeded to start pgadmin4 as an administrator. This also did not work. Finally, I resolved this by restarting postgresql service in services.msc. postgres service restart

1

In my case, the problem was non-ascii username.

Find pgAdmin installation and open/create config_local.py in editor, add this:

DATA_DIR = "C:/Data/pgAdmin" # set non-ascii path here

and run setup.py using python interpreter.

1

You can start the server manually - any errors will echo on the terminal. The windows app seems touchy on timing - this allows the server to take as much time as needed to start up.

Assuming you installed version 3 into "p:\pgAdmin 4" run the following commands"

p:
cd "\pgAdmin 4\v3\web"
set PYTHONPATH=P:\pgAdmin 4\v3\venv\Lib;P:\pgAdmin 4\v3\venv\DLLs
python pgAdmin4.py

When I run that I get the following output:

Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.
0

I ran into this today even though the service was running in Windows 10. I just stopped the service, gave it a few seconds, and restarted it. I was able to connect with pgAdmin 4.

0

In my case the problem was solved by restarting the postgresql service. Windows-> Service -> find for postgreSQL -> Stop and then Start

Not the answer you're looking for? Browse other questions tagged or ask your own question.