You can connect to a TencentDB for MySQL instance in the following ways:
For more information, please see Connecting to MySQL Instance.
Log in to the TencentDB for MySQL Console, click an instance name in the instance list to enter the instance details page, and view the private/public network address.
Log in to the TencentDB for MySQL Console, click an instance name in the instance list to enter the instance details page, and enable the public network address in "Public Network Address".
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.
We recommend you use One-Click Connectivity Checker to troubleshoot the problem first and then find the corresponding solution in [Common Problems] according to the check report.
No. For more information about the solution, please see Troubleshooting Connection Errors > Different regions.
Even if the CVM and TencentDB for MySQL instances are in the same region, they may be in different VPCs.
No. But you can use Peering Connection to connect them over the private network.
You can troubleshoot the problem in the following ways:
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 > Manage Account 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
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.
If the connectivity test fails during data migration, check whether the security policy allows the prompted migration proxy IP.
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.