Get the App
SLTechnology News&Howtos  ›  Database  › 

Maximum number of connections to MySQL database

Shulou Source: shulou.com Published: 2022-06-01 05:01:32 11月25日 Update

Background knowledge:

MySQL maximum number of connections default value is 100, for a large number of concurrent connections database, when the connection request is greater than the default number of connections, there will be an error can not connect to the database, so we need to increase it appropriately, when using MySQL database, often encounter such a problem, that is,"Can not connect to MySQL server." Too many connections"-mysql 1040 error, this is because the number of unreleased connections accessing MySQL has reached MySQL's limit. Usually, the maximum number of connections for mysql defaults to 100, and the maximum number can reach 16384.

MySQL Maximum number of connections View and modify

1. View the maximum number of connections after logging into the database

show variables like '%max_connections%';

2. Modify the maximum number of connections

set GLOBAL max_connections = 200;

Note: Using this method to modify the maximum number of database connections can only take effect in the current mysql service process. Once mysql restarts, it will return to the initial state. Because mysql needs to read the data in the/etc/my.cnf configuration file during initialization and startup, it is recommended to write the parameter max_connections in the mysql configuration file/etc/my.cnf.

Tags: Maximum data database file error configuration large appropriate upper limit parameter that is regular meeting number way time state knowledge background process Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi vpn Shulou Tech Info Linux Huawei