Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Databases in psql Don't Show up in PgAdmin4

I installed Postgres

image

and followed the instruction. I create a database and logged in by the master password but I don't find the database even the + mark is not shown in the servers. can anyone help, please?

like image 422
Murwan eisa Avatar asked May 03 '20 15:05

Murwan eisa


People also ask

How do I open PostgreSQL database in pgAdmin 4?

Specify the “Port” as “5432”. Enter the name of the database in the “Database Maintenance” field. Enter your username as postgres and password (use the same password you used when previously configuring the server to accept remote connections) for the database. Click “Save” to apply the configuration.

How do I add a postgres database to pgAdmin?

Using a GUI Run pgAdmin. Right-click on the item Servers , select Create -> Server and provide the connection to your PostgreSQL instance set up in step 1. In the default PostgreSQL setup, the administrator user is postgres with an empty password. In the connection tab be sure to have the host set to localhost .

How do I SELECT a PostgreSQL database in pgAdmin 4?

Select Database using pgAdmin You can also select the database and open SQL Query window in pgAdmin UI. Step 1: Select the database, by clicking on it. Now, click on the Tools drop down menu and click on Query Tool . Now, a new window appears with a connection make to the database you selected.

How do I list databases in pgAdmin?

Step 1: Open the pgAdmin app and enter your password to connect to the database server. Step 2: Expand the Servers tree and then the Databases tree. The tree expands to show a list of all databases on the server. Click the Properties tab to see more information about each database.


1 Answers

Unlike in pgAdmin3, with pgAdmin4,
here you have to manually connect to a running postgres server and
you already have your specific database (DB) created.

So to set the stage, make sure you have the postgres server is running, and that you have created that DB already too.

Creating the database and grant privileges using CLI

Notice (in the image) that I CREATE database XYZ and GRANT all privileges to default user postgres. (Note; to work properly with pgAdmin4, you have to create a user called postgres in order to be able to connect with and log in to pgAdmin4.)

Then here are some quick steps to follow:

  1. When within pgAdmin4, right-click the Servers option and select create.

Note:

  • In the image you'll see (1) next to "Servers" because I have done this process already. Kindly ignore that).
  • Select "server group" if you have many servers that you want to better manage. For most basic use cases, go ahead and select "server" (like I did).

Initialize process to create a server


  1. For either option you select above, you'll get a pop-box to complete the "connection process". I selected "server" which is appropriate for your use case (see image below).

Note:

  • "name" field is required
  • As you can see already, enter a name (I went with "postgres" since it's what I was used to by default in pgAdmin3, but you can enter any name).
  • Notice the "connect now" checkbox is checked by default so as soon as the process is successful, your DB should display in the sidemenu. (This is a key to confirm that you entered the right info). But you can always uncheck this, to connect later.

Enter the server name


  1. Now, click connection tab and you see the image below.
    The key fields to fill here, to keep it simple, are host name/address and password. Remember to save after entering your info.

Note:

  • If on connecting to local machine, localhost or http://127.0.0.1 should do. (I did "localhost")
  • If connecting to a DB instance in the cloud e.g. AWS, enter the endpoint in the host space.
    Here's more from AWS
  • A lot of the other fields have the default settings used when installing postgres and pgAdmin.

Enter the host name/address and user password


If you followed the steps above properly, then you should see something like this after you save.

This is the "sign of victory"


Here's a good guide from the pgAdmin documentation

like image 102
MwamiTovi Avatar answered Sep 29 '22 07:09

MwamiTovi