Connect with pgcli
Learn how to connect to Neon using the interactive pgcli client
pgcli client is an interactive command-line interface for Postgres that offers several advantages over the traditional
psql client, including syntax highlighting, autocompletion, multi-line editing, and query history.
For installation instructions, please refer to the
pgcli installation documentation.
pgcli usage information, run the following command:
Connect to Neon
The easiest way to connect to Neon using the
pgcli client is with a connection string, which you can obtain from the Connection Details widget on the Neon Dashboard. Select a branch, a role, and the database you want to connect to. A connection string is constructed for you.
From your terminal or command prompt, run the
pgcli client with the connection string. Your command will look something like this:
After establishing a connection, try the
pgcli client by running the following queries. To test the
pgcli autocompletion feature, type the
The following result is returned:
pgcli query history feature allows you to use the Up and Down keys on your keyboard to navigate your query history.
pgcli client also supports named queries. To save a query, type:
To run a named query, type:
For more information about
pgcli features and capabilities, refer to the pgcli documentation.
Last updated on