tencent cloud

TencentDB for MySQL

Release Notes and Announcements
Release Notes
Product Announcements
User Tutorial
Product Introduction
Overview
Strengths
Use Cases
Database Architecture
Resource Isolation Policy
Economical Instance
Feature List
Database Instance
High Availability (Multi-AZ)
Regions and AZs
Service Regions and Service Providers
Kernel Features
Overview
Kernel Version Release Notes
Functionality Features
Performance Features
Security Features
Stability Features
TXRocks Engine
LibraDB Engine
Checking and Fixing Kernel Issues
Purchase Guide
Billing Overview
Selection Guide
Purchase Methods
Renewal
Payment Overdue
Refund
Pay-as-You-Go to Monthly Subscription
Instance Adjustment Fee
Backup Space Billing
Database Audit Billing Overview
Commercial Billing and Activity Description for Database Proxy
Description of the Database Proxy Billing Cycle
Viewing Bills
Getting Started
Overview
Creating MySQL Instance
Connecting to MySQL Instance
SQL Insight (Database Audit)
Overview
Viewing Audit Instance List
Enabling Audit Service
Viewing Audit Log
Log Shipping
Configuring Post-Event Alarms
Modifying Audit Rule
Modifying Audit Services
Disabling Audit Service
Audit Rule Template
SQL Audit Rule (Legacy)
Viewing Audit Task
Authorizing Sub-User to Use Database Audit
MySQL Cluster Edition
Introduction to TencentDB for MySQL Cluster Edition
Creating TencentDB for MySQL Cluster Edition Instance
Maintenance Management Instance
Viewing Instance Monitoring
Adjusting Instance Configuration
Operations for Other Features
Migrate or upgrade to TencentDB for MySQL Cluster Edition
Operation Guide
Use Limits
Operation Overview
Instance Management and Maintenance
Instance Upgrade
CPU Elastic Expansion
Read-Only/Disaster Recovery Instances
Database Proxy
Database Management Center (DMC)
Account Management
Parameter Configuration
Backup and Rollback
Data Migration
Network and Security
Monitoring and Alarms
Log Center
Read-Only Analysis Engine
Tag
Practical Tutorial
Using TencentDB for MySQL to Upgrade MySQL 5.7 to MySQL 8.0
Methods and Instructions for Upgrading from MySQL 5.6 to MySQL 5.7
Cybersecurity Classified Protection Practice for Database Audit of TencentDB for MySQL
Building All-Scenario High-Availability Architecture
Usage Specifications of TencentDB for MySQL
Configuring Automatic Application Reconnection
Impact of Modifying MySQL Source Instance Parameters
Limits on Automatic Conversion from MyISAM to InnoDB
Creating VPCs for TencentDB for MySQL
Enhancing Business Load Capacity with TencentDB for MySQL
Setting up 2-Region-3-DC Disaster Recovery Architecture
Improving TencentDB for MySQL Performance with Read/Write Separation
Migrating Data from InnoDB to RocksDB with DTS
Building LAMP Stack for Web Application
Building Drupal Website
Calling MySQL APIs in Python
The primary and secondary instances have inconsistent query data
White Paper
Performance White Paper
Security White Paper
Troubleshooting
Connections
Performance
Instance Data Sync Delay
Failure to Enable Case Insensitivity
Failure to Obtain slow_query_log_file via a Command
API Documentation
History
Introduction
API Category
Instance APIs
Making API Requests
Data Import APIs
Database Proxy APIs
Database Audit APIs
Security APIs
Task APIs
Backup APIs
Account APIs
Rollback APIs
Parameter APIs
Database APIs
Monitoring APIs
Log-related API
Data Types
Error Codes
FAQs
Related to Selection
Billing
Backup
Rollback
Connection and Login
Parameter Modifications
Instance Upgrade
Account Permissions
Performance and Memory
Ops
Data Migration
Features
Console Operations
Logs
Event
Database audit
Instance Switch Impact
API 2.0 to 3.0 Switch Guide
Service Agreement
Service Level Agreement
Terms of Service
Reference
Standards and Certifications
Contact Us
Glossary

Connection

PDF
Focus Mode
Font Size
Last updated: 2026-01-14 14:24:56

How do I connect to a TencentDB for MySQL instance?

You can connect to a TencentDB for MySQL instance in the following ways:
Private network connection: a CVM instance can be used to connect to the private network address of a TencentDB instance. This method relies on the high-speed private network of Tencent Cloud and features low delay. The two instances must be under the same account and in the same VPC in the same region, or both in the classic network.
Public network connection: if you cannot access the private network, you can connect to your TencentDB for MySQL instance at its public network address. The public network address needs to be manually enabled. It can be viewed on the instance details page in the TencentDB for MySQL console and can be disabled if no longer needed.
For more information, please see Connecting to MySQL Instance.

What should I do if the connection to TencentDB for MySQL failed?

Failure to connect to TencentDB for MySQL from CVM or local computer

1. Use the diagnosis tool to locate the causes The TencentDB for MySQL console provides a one-click connectivity check tool to help you locate the causes of connection failures. Then, you can make changes according to the prompts and retry to connect to the instance.
2. Locate the causes by yourself If you cannot locate the cause of the problem with the one-click connectivity check tool, you can try to locate the cause by yourself by referring to the failure causes as described in Instance Connection Failure.

Failure to connect to TencentDB for MySQL from DMC

1. Confirm that the database account has authorized all IPs of DMC servers in the region. For more information on authorization, please see Modifying Host Addresses with Access Permissions. You can also set % as the host address authorized by the database account to allow all IPs and only use security groups to control database access.
2. If you confirm that all needed IPs are authorized, then the cause may be incorrect password. Accordingly, you can enter the password again, reset the password, or create a temporary account with sufficient permissions.
For more information, please see Instance Connection Failure.

How do I view the private/public network addresses?

Log in to the TencentDB for MySQL console, click an instance ID in the instance list to enter the instance details page, and view the private/public network addresses.

How do I enable the public network address?

Log in to the TencentDB for MySQL console, click an instance ID in the instance list to enter the instance details page, and enable the public network address in Public Network Address.

What should I do if I have slow access over the public network?

We recommend you use the private network. This connection method uses the high-speed private network with a low delay. For more information, please see Connecting to MySQL Instance.

Can I use a CVM instance to connect to the private network address of a TencentDB for MySQL instance?

1. The following conditions must be met before you can use private network access: The two instances must be in the same VPC in the same region, or both in the classic network.
2. You can check whether they are in the same VPC or both in the classic network in the following ways:
You can log in to the CVM console and view the network information of a CVM instance in the instance list or on the instance details page.
You can log in to the TencentDB for MySQL console and view the network information of an instance in the instance list or on the instance details page.
For more information, please see Viewing network type and VPC information.

What should I do if I can't use a CVM instance to connect to the private network address of a TencentDB for MySQL instance?

We recommend you use the one-click connectivity check tool to troubleshoot the problem first and then find the corresponding solution in Instance Connection Failure according to the check report.

My CVM and TencentDB for MySQL instances are in different regions (such as Guangzhou and Shanghai, respectively). Can I use the private network for connection?

No. For solutions, please see CCN Connection.

My CVM and TencentDB for MySQL instances are in different AZs (such as Shanghai Zone 2 and Shanghai Zone 3, respectively) in the same region. Can I use the private network for connection?

Even if the CVM and TencentDB for MySQL instances are in the same region, they may be in different VPCs.
If they are in different AZs in the same VPC, they can interconnect over the private network.
If they are in different VPCs (such as VPC1 and VPC2, respectively), they cannot interconnect over the private network. You can switch the network of the MySQL instance to match that of the CVM by following the instructions provided in the Network Switch guide.

Can I use a CVM instance to connect to a TencentDB for MySQL instance directly over the private network when they are under different accounts?

No. However, you can use CCN to implement cross-account connection over the private network.

The verification with telnet found that the network and port connectivity of the TencentDB instance was good, but an error was reported when I tried to log in to it on the command line in the CVM instance. What should I do?

If "ERROR 1045(28000):Access denied for user..." is displayed, check whether the instance account and password entered are correct. If you forgot the password, you can reset it. If the error persists after you enter the correct information again, log in to the TencentDB for MySQL console, click an instance name to enter the instance management page, select Database Management > Account Management to check whether restrictions are imposed on the IP connecting to your instance.
The message "ERROR 1040(00000):Too many connections" indicates that the number of current connections to the TencentDB instance exceeds the limit. The common reasons and solutions are as follows: i. There are too many sleeping threads. We recommend you lower the values of wait_timeout and interactive_timeout in the console. ii. Slow queries heaped up. The long_query_time parameter is 10s by default. We recommend you change it to 1–2s and then observe slow query logs. iii. If there are few sleeping threads and no slow queries heaped up, we recommend you increase the value of the max_connections parameter in the console.
If "ERROR 2003 (HY000): Can't connect to MySQL server..." is displayed, check whether the instance IP and port entered are correct. If the error persists after you enter the correct information, check the security group policies of the instance in the console to verify whether the CVM instance has the permission to connect to the database. For more information, please see TencentDB Security Group Management.
If the connectivity test fails during data migration, check whether the security policy allows the prompted migration proxy IP.
Check the init_connect parameter (if set), such as mysql>set global init_connect='insert into db_monitor.accesslog(thread_id,log_time,localname,matchname) values(connection_id(),now(),user(),current_user())';. This means that each connection to the database by each non-super-privileged user will insert an entry into the db_monitor.accesslog table. Once there are uncommitted transactions or relevant lock waits in the table, then insert into db_monitor.accesslog operations will be jammed, causing all connections by non-super-privileged users to be stuck and affecting the normal use of TencentDB. Therefore, please configure the init_connect parameter with caution.

Help and Support

Was this page helpful?

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

Feedback