13

I am study with this tutorial: https://www.youtube.com/watch?v=Ho3DKKopC2E&list=PLDmvslp_VR0xlwr5lAx2PDsZLu7oIOhpX&index=20

When I connect to db, I want to connect the db like the turorial:

enter image description here

But I failed, because I don't know how to do with it:

enter image description here

Does anyone knows how to do with it?

Murtuza Z
  • 5,639
  • 1
  • 28
  • 52
aircraft
  • 25,146
  • 28
  • 91
  • 166

4 Answers4

31

Add new server steps:

  1. Open pgAdmin4

  2. Right click in "Servers" in Browser panel

  3. Enter some meaningful name for Server eg: "PostgreSQL9.6"

  4. Click on "Connection" tab

  5. Enter "Host" (default is "localhost" if database is installed on your own local system otherwise IP address of system where PostgreSQL database is installed)

  6. Enter "Port" (default port for PostgreSQL server is "5432")

  7. Enter "Maintenance Database" name (default is "postgres")

  8. Enter "User Name" (default user is "postgres")

  9. Enter "Password" (Password which you gave when you installed PostgreSQL database for "postgres" user)

  10. Click on CheckBox "Save password?" to save your password in pgAdmin4 for future use.

Now as you can see, "Save" button gets enable in dialog, just click on it.

You will see that your server is now listed under "Servers" and you should be connected to your database.

John Smith
  • 7,243
  • 6
  • 49
  • 61
Murtuza Z
  • 5,639
  • 1
  • 28
  • 52
2

You are getting error because You did not specified Name for server, Click on "General" tab provide name for your server like "PostgreSQL9.6"

Refer the pgAdmin4 documents:

Connecting to server: https://www.pgadmin.org/docs4/dev/connecting.html

Creating new server: https://www.pgadmin.org/docs4/dev/server_dialog.html

While creating new Server you should have all the required parameters like,

Host (default is "localhost" if database is installed on local system), Port(default is "5432"), Maintenance Database Name (default is "postgres"), User Name (default is "postgres"), Password 

Without above required information you can't connect to PostgreSQL database server.

Murtuza Z
  • 5,639
  • 1
  • 28
  • 52
  • But I get this issue: http://img1.ph.126.net/fhmXJbIaKSaaSFRW8bP5Gw==/6632074918351502842.png, could you give me a details steps? – aircraft Jan 28 '17 at 01:53
1

localhost did no work for me, but my server ip (192.168.xx.x) address worked. The x needs to be replace with you ip address.

WCS
  • 69
  • 1
  • 15
  • If localhost doesn't work, you're probably missing it in your hosts file. But the inability to resolve 'localhost' can potentially mean you've messed your name resolution up. Good luck! – user2066657 Nov 30 '19 at 21:40
1

If you created a database from the docker, use the 'docker inspect ID_IMAGE' to see the IP address. This IP address will be put in pgadmin in the connection tab in the first input "host name/address". If you mirrored the default postgress port on docker-compose.yml for 5432 like ports: 5432:5432 the IP address will be input "host name/address" and will only receive this value '0.0.0.0'

Connell.O'Donnell
  • 3,603
  • 11
  • 27
  • 61