tencent cloud

TencentDB for PostgreSQL

Release Notes and Announcements
Release Notes
Product Announcements
Product Introduction
Overview
Features
Strengths
Scenarios
Information Security
Regions and AZs
Product Feature List
Large version lifecycle description
MSSQL Compatible Version
Billing
Billing Overview
Instance Type and Specification
Purchase Methods
Refund
Overdue Payments
Backup Space Billing
Database Audit Billing Overview
Getting Started
Creating TencentDB for PostgreSQL Instance
Connecting to TencentDB for PostgreSQL Instance
Managing TencentDB for PostgreSQL Instance
Importing Data
Migrating Data with DTS
Kernel Version Introduction
Kernel Version Overview
Kernel Version Release Notes
Viewing Kernel Version
Proprietary Kernel Features
Database Audit
Audit Service Description
Activating Audit Service
View Audit Logs
Modify audit services
Audit Performance Description
User Guide
Instance Management
Upgrading Instance
CPU Elastic Scaling
Read-Only Instance
Account Management
Database Management
Parameter Management
Log Management and Analysis
Backup and Restoration
Data Migration
Extension Management
Network Management
Access Management
Data Security
Tenant and Resource Isolation
Security Groups
Monitoring and Alarms
Tag
AI Practice
Using the Tencentdb_ai Plug-In to Call Large Models
Building Ai Applications with the Tencentdb Ai Plug-In
Combining Supabase to Quickly Build Backend Service Based on TencentDB for PostgreSQL
Use Cases
postgres_fdw Extension for Cross-database Access
Automatically Creating Partition in PostgreSQL
Searching in High Numbers of Tags Based on pg_roaringbitmap
Querying People Nearby with One SQL Statement
Configuring TencentDB for PostgreSQL as GitLab's External Data Source
Supporting Tiered Storage Based on cos_fdw Extension
Implement Read/Write Separation via pgpool
Implementing Slow SQL Analysis Using the Auto_explain Plugin
Using pglogical for Logical Replication
Using Debezium to Collect PostgreSQL Data
Set Up a Remote Disaster Recovery Environment for PostgreSQL Locally on CVM
Read-Only Instance and Read-Only Group Practical Tutorial
How to Use SCF for Scheduled Database Operations
Fix Table Bloat
Performance White Paper
Test Methods
Test Results
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Read-only Replica APIs
Backup and Recovery APIs
Parameter Management APIs
Security Group APIs
Performance Optimization APIs
Account APIs
Specification APIs
Network APIs
Data Types
Error Codes
FAQs
Service Agreement
Service Level Agreement
Terms of Service
Glossary
Contact Us
DocumentationTencentDB for PostgreSQLGetting StartedConnecting to TencentDB for PostgreSQL Instance

Connecting to TencentDB for PostgreSQL Instance

PDF
Focus Mode
Font Size
Last updated: 2025-09-10 22:10:40
You can use a standard SQL client to access it over the private network or public network.
Private network access: a CVM instance can be used to access the private network address automatically assigned to the TencentDB instance. This access method relies on the high-speed private network of Tencent Cloud and features low delay. It is recommended that the CVM and database use the same account and be located in the same VPC ( ensuring the same region ) or both in the classic network.
Note:
CVM and TencentDB instances in different VPCs (under the same or different accounts in the same or different regions) can be interconnected over private network through Peering Connection.
Public network access: TencentDB for PostgreSQL can be accessed by using a public network address.
Note:
For public network access, the database instance's public IP needs to be enabled, which may expose your database service to attacks or intrusions on the public network. Therefore, it is recommended to log in to the database over the private network.
Public network access to TencentDB is suitable for development or auxiliary management of databases but not for business access in the production environment, as potentially uncontrollable factors may lead to unavailability of the public network access, such as DDoS attacks and bursts of high-traffic access.
Instances that currently support public network access are available only in Guangzhou, Shanghai, Beijing, Chengdu, Hong Kong (China), and Silicon Valley.
The following describes how to connect to a TencentDB for PostgreSQL instance from Windows and Linux CVM instances over the private and public networks.

Connecting from a Windows CVM Instance

1. Download and install a standard SQL client in a Windows CVM instance or locally. For more information about how to log in to a CVM instance, please see Customizing Windows CVM Configurations.
Note:
Take pgAdmin for example. You can download an installer Quick Links based on your operating system version.
2. In pgAdmin, select Object > Create > Server.


3. In the Create - Server dialog box, enter the information such as host name/address, port number, username, and password and then click Save.
Host name/address and port number: you can go to the TencentDB for PostgreSQL console and view them in Private IPv4/IPv6 Address or Public IPv4/IPv6 Address in the Basic Info section on the instance details page. If the public IP is not enabled, please see Enabling Public Network Access.
Note:
Here, the private IP is VIP; database instances are accessed by connecting to the gateway cluster rather than the physical servers of database instances directly. Therefore, the private IP will remain unchanged in the event of server failures or primary/standby switchover.
Username and password: use the database admin username and password set when the instance is initialized. If you forget the password, you can go to the account management page in the console to reset it.

4. Then, select Databases > postgres on the left sidebar to view the connected server (database instance).


Connecting from a Linux CVM Instance

1. Install a psql client via yum in a Linux CVM instance or locally. For more information about how to log in to a CVM instance, please see Customizing Linux CVM Configurations.
2. To install a psql client, please follow the instructions in Restoring PostgreSQL Data on CVMs > Install PostgreSQL to install PostgreSQL, as the psql client will be installed along with PostgreSQL.
3. Run the following command to log in to the PostgreSQL database:
psql -U username -h access address -p port -d postgres
Note:
To access from a CVM instance in the same VPC of the database instance, use the private IP of the database instance as the access address. To access from a Linux server on the internet, use the public IP of the database instance as the access address.

Appendix: Enabling Public Network Access

1. Log in to the TencentDB for PostgreSQL console. In the instance list, click the instance ID/name or Manage in the Operation column to access the instance details page.
2. Click Enable next to Public IPv4/IPv6 Address in the Basic Info section on the instance details page.

3. Click OK in the pop-up window and the request to enable public IP will be processed.
4. Once enabled successfully, the public IP can be found in the Basic Info section.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback