LucasPG
LucasPG

Reputation: 433

Postgresql can't connect application server through PGAdmin4

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.

Upvotes: 13

Views: 66346

Answers (8)

Maria Santosr
Maria Santosr

Reputation: 1

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

Upvotes: 0

Abby Jones
Abby Jones

Reputation: 1

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.

Upvotes: 0

NBender
NBender

Reputation: 21

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.

Upvotes: 1

Shashank
Shashank

Reputation: 35

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

Upvotes: 2

Lucas Gervas
Lucas Gervas

Reputation: 379

My config_distro.py was missing this line:

MINIFY_HTML=False

I added it as in the above steps and it works

Upvotes: 3

cybersoft
cybersoft

Reputation: 1473

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.

Upvotes: 1

Daniel
Daniel

Reputation: 1110

Try starting the pgAdmin as administrator.

Upvotes: 9

Sorin Călinică
Sorin Călinică

Reputation: 596

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

Upvotes: 38

Related Questions