Connecting to PostgreSQL via Shell/SSH

The article will show you how to connect to your PostgreSQL via Shell/SSH in the Control Panel.

Shell/SSH (WebShell) is a web-based shell-like interface that enables remote access and management of an application by allowing the execution of arbitrary commands. You can issue commands to perform operations like monitoring, debugging, configuration parameters changing, a single database backing up, and etc.

Please note:

The default connection time-out time for a shell session is 60 minutes. Any network disconnection will cause WebShell disconnection.

1. Locate the target PostgreSQL deployment

Log in to the Control Panel and locate your target application on the Home page or the My Applications page.

2. Creat database and user

If there is not any database or user, create the database and user first. Click the "Manage" button on the Home page or the My Applications page. Then Click the “DB & User” tab in the menu bar on the left. On the page, you can create your databases and users.

3. Connect to PostgreSQL

Connect to PostgreSQL Server with the default super user

"postgres" is the default super user we created in PostgreSQL servers. You can connect to PostgreSQL server with "postgres" without password by issuing the command psql -U postgres or psql -h 127.0.0.1 -p 5432 -U postgres

Connect to PostgreSQL Server with a regular user

The regular user should have access permission to the database. For this topic, you can refer to Managing Database Access Permission for a user

Either of the commands below can be used in a shell session to connect to a PostgreSQL database.

psql -U <mypostgresuser> -d <mypostgres> or psql -h 127.0.0.1 -p 5432 -U <mypostgresuser> -d <mypostgres>

<mypostgresuser>: the name of a PostgreSQL user.

<mypostgres>: the database name you would like the user to connect to.

If any further assistance is needed, feel free to contact us.

Copyright © 2021 Cloud Clusters Inc. all right reserved,powered by GitbookRevised on 05/10/2021

results matching ""

    No results matching ""