tencent cloud

Feedback

CCN Connection Failure

Last updated: 2023-12-27 10:37:22

    Symptom

    Failed to connect to a TencentDB for MySQL instance through its private network address from a CVM or LIGHTHOUSE.
    Note:
    There are various methods to connect to a TencentDB for MySQL instance, including connecting through private network, public network, or CCN, each requiring different connection conditions. For instance, if you attempt to connect to TencentDB for MySQL instance through a public network but you entered the instance's private network address in the command line, the connection will fail. Similarly, if you are using a Lighthouse instance to connect directly to TencentDB for MySQL without going through CCN, the connection will also fail. Therefore, in case of a connection failure, we recommend you first refer to the connection methods and application scenarios in Getting Started > Connecting to MySQL Instances > Overview to check whether you are adopting a proper connection method.

    Causes

    Possible Causes
    Description
    The password is incorrect.
    The database account has restricted the access to specific host addresses.
    The connection command is incorrect.
    The IP and port in the command line or configuration file are incorrect.
    The route table is not enabled.
    The MySQL instance's disk is full; maximum connections have been reached; the timeout parameter setting is incorrect; a master/slave switch is undergoing, or other possible issues.
    MySQL Instance Operating Status Issues
    The MySQL instance is in isolation. It can be restored from the Recycle Bin.
    CVM Instance Status Issues
    The CVM instance is in isolation or shut down. It can be restored or powered on through the Console.
    LIGHTHOUSE Instance Status Issues
    The LIGHTHOUSE instance is in isolation or shut down. It can be restored or powered on through the Console.

    Solution

    For CCN connection, since there is no one-click connectivity check tool available, we recommend you follow the subsequent instructions for self-check and troubleshooting.

    Self-Check and Troubleshooting

    Password issue: The password is incorrect.

    If the password used during the connection is incorrect, you can either reset your password or create a temporary account with necessary permissions to log in the database.

    **Issues related to the host addresses authorized by account: The database account has restricted the access to specific host addresses.

    In addition to the security group, subnet, and other network environment restrictions, the database account is also subject to constraints imposed by the MySQL account system itself. If a database account specifies certain host addresses, connections from other addresses to MySQL will be denied. You can enhance the security of your database connection by using the TencentDB for MySQL console to modify the host addresses authorized by the database account.
    1. Log in to the TencentDB for MySQL console, select an instance ID from the instance list to enter the instance management page.
    2. Navigate to DMC > Account Management, locate the account for which host modification is required, and in the Operation column, choose More > Modify Host.
    3. In the pop-up dialog box, enter the new host address and click OK to modify the host address authorized to the account.
    Note:
    The host address can be an IP or % (indicating no limits on the IP range). Multiple hosts should be separated using a line break, space, or the symbols ; , |.
    Example 1: Entering
    Example 2: Entering 10.5.10.%, indicates that the clients within the 10.5.10.%IP range are allowed to use this account to connect to the database.

    Connection syntax issue: The connection command is incorrect.

    Please verify the correctness of the connection command. Please refer to the standard command for a public network connection:
    mysql -h <private IP address> -u <username, default is root> -P <private port number> -p
    <Private network IP address>: Replace it with the private network address of your target MySQL instance, which can be viewed on the instance details page in the TencentDB for MySQL console.
    <username, default is root>: Replace it with the account name of your target MySQL instance. The default account name is root.
    <Private port number>: Replace the port number with the private port number of your target MySQL instance. The default is 3306, but if it has been changed, please use the adjusted port number.

    IP and port issue: The IP address or port in the command line or configuration file is incorrect.

    When attempting to connect to the database using commands, please ensure that the private network IP and port number of the instance are correct. These details can be accessed from the instance details page in the TencentDB for MySQL console.
    

    CCN pouting issue: Route table is not enabled.

    Before you connect to the database via CCN, you need to establish interconnectivity between LIGHTHOUSE and the private network of the CCN instance. Then, under the CCN instance, you must add the network address of the target MySQL's VPC. If the routing towards the network segment of the target MySQL's VPC is not enabled in the route table under the CCN instance, connection cannot be established. You need to enable the corresponding routing and reconnect.

    MySQL instance issue: The MySQL instance's disk is full. The maximum connections have been reached. The timeout parameter setting is incorrect. A master/slave switch is undergoing.

    If the MySQL instance disk is full, it may affect database connectivity. It's recommended to expand the disk capacity. For the procedure, please refer to Adjusting Database Instance Specification.
    When the error message "ERROR 1040(00000): Too many connections" is displayed, it indicates that the maximum number of connections for the current CDB instance has been reached. Common causes and solutions are as follows: i. If there are too many sleep threads, it's advised to decrease the values of the wait_timeout and interactive_timeout parameters via the console. For details, please refer to Setting Instance Parameters. ii. If there are few sleep threads and no slow query accumulation, it's suggested to increase the value of the max_connections parameter via the console. For details, please refer to Setting Instance Parameters.
    Check whether the MySQL instance is in a "master-slave switch state", as connection attempts will fail if the MySQL instance is in the middle of a master-slave switch. After the switch has completed, connect using the command again.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support