Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PostgreSQL pgAdmin Tool

PostgreSQL pgAdmin Tool

pgAdmin is an open-source PostgreSQL database management tool that provides a graphical interface to simplify database management and operations.

pgAdmin is the officially recommended management tool for PostgreSQL, supporting everything from simple queries to complex database management tasks, suitable for developers and database administrators.

Main Function


Installing pgAdmin

pgAdmin official website:https://www.pgadmin.org/。

pgAdmin Github source address:https://github.com/pgadmin-org/。

pgAdmin 4 is a complete rewrite of pgAdmin, built on Python, ReactJS, and JavaScript.

pgAdmin 4 supports two running modes:

Download address:https://www.pgadmin.org/download/

Installation on Windows

  1. Access the pgAdmin official website
  2. Download the installer for Windows
  3. Run the installer and follow the wizard to complete installation
  4. After installation, you can find pgAdmin in the Start menu

Installation on macOS

  1. Install using Homebrew:brew install --cask pgadmin4
  2. Or download the macOS installer from the official website
  3. Drag pgAdmin to the Applications folder

Installation on Linux systems

For Debian-based systems (such as Ubuntu):



sudo apt update

sudo apt install pgadmin4

For Red Hat-based systems (such as CentOS):



sudo yum install pgadmin4


Basic usage of pgAdmin

Connect to a PostgreSQL server

  1. Open pgAdmin
  2. In the "Browser" panel on the left, right-click "Servers"
  3. Select "Create" > "Server..."
  4. Fill in the connection information in the dialog that appears:
  5. Name: Give the connection a name
  6. Host: Database server address (use localhost for local)
  7. Port: PostgreSQL port (default 5432)
  8. Maintenance database: Usually postgres
  9. Username and Password: Database credentials
  10. - **Name**: Give the connection a name - **Host**: Database server address (use localhost for local) - **Port**: PostgreSQL port (default 5432) - **Maintenance database**: Usually postgres - **Username** and **Password**: Database credentials

    Browse database objects

    After a successful connection, you can expand the server node to view:


    Core features of pgAdmin

    Database management

    1. Create the database:

    2. Right-click "Databases" > "Create" > "Database..."
    3. Fill in the database name and other options
    4. - Right-click "Databases" > "Create" > "Database..." - Fill in the database name and other options
      1. Drop the database:

      2. Right-click the database to delete > "Delete/Drop"
      3. Confirm the operation
      4. - Right-click the database to delete > "Delete/Drop" - Confirm the operation
        1. Backup and restore:

        2. Right-click the database > "Backup..." or "Restore..."
        3. Choose the backup file location and options
        4. - Right-click the database > "Backup..." or "Restore..." - Choose the backup file location and options

          Table operations

          1. Create a table:

          2. Expand the database > right-click "Tables" > "Create" > "Table..."
          3. Define column names, data types, and constraints
          4. - Expand the database > right-click "Tables" > "Create" > "Table..." - Define column names, data types, and constraints
            1. View and edit data:

            2. Right-click the table > "View/Edit Data" > "All Rows"
            3. You can edit data directly in the data grid
            4. - Right-click the table > "View/Edit Data" > "All Rows" - You can edit data directly in the data grid
              1. Executes an SQL query:

              2. Click the "SQL" button on the toolbar
              3. Enter SQL statements in the query editor
              4. Click the "Execute" button or press F5 to run the query
              5. - Click the "SQL" button on the toolbar - Enter SQL statements in the query editor - Click the "Execute" button or press F5 to run the query

                Advanced features of pgAdmin

                Query tools

                pgAdmin provides powerful query tools, including:

                Performance monitoring

                The dashboard allows you to monitor:

                Import/export data

                pgAdmin supports import and export of multiple data formats:


                pgAdmin usage tips

                1. Keyboard shortcut:

                2. F5: Execute query
                3. Ctrl+Enter: Execute the selected query
                4. Ctrl+/: Comment/uncomment code
                5. - F5: Execute query - Ctrl+Enter: Execute the selected query - Ctrl+/: Comment/uncomment code
                  1. Save frequently used queries:

                  2. You can save frequently used queries as favorites in the "Query Tool"
                  3. - You can save frequently used queries as favorites in the "Query Tool"
                    1. Customize the interface:

                    2. Customize the interface layout and settings via "File" > "Preferences"
                    3. - Customize the interface layout and settings via "File" > "Preferences"
                      1. Use the ERD tool:

                      2. You can generate an entity-relationship diagram (ERD) of the database
                      3. - You can generate an entity-relationship diagram (ERD) of the database
                        1. Back up the configuration regularly:

                        2. pgAdmin's configuration is stored in the user directory; regular backups are recommended
                        3. - pgAdmin's configuration is stored in the user directory; regular backups are recommended

                          Alternatives to pgAdmin

                          Although pgAdmin is powerful, there are some alternative tools:

                          1. DBeaver: A general tool supporting multiple databases
                          2. DataGrip: A professional database IDE from JetBrains
                          3. TablePlus: A modern, lightweight database client
                          4. psql: The command-line tool bundled with PostgreSQL

                          Frequently Asked Questions

                          Why does pgAdmin start slowly?

                          pgAdmin is an application based on Python and web technologies; the first launch may take some time to load. You can try:

                          How to reset the pgAdmin password?

                          1. Stop the pgAdmin service
                          2. Delete the pgAdmin configuration file in the user directory
                          3. Restart pgAdmin

                          What to do if an authentication error occurs when connecting to a database?