|Subject:||Increasing connection limit in MySQL|
|Creation date:||4/7/10 8:19 AM|
|Last modified on:||4/7/10 8:36 AM|
Connection limits in MySQL
Database connections in MySQL are limited to a finite number by default. You can see the existing connection limit through WinSQL. Refer to the image below.
Increasing this limit
There are two approaches to tackle this problem:
- Modify User Limit
- Modify Global Limits
User limits are typically specified when you first create a user. Consider the following SQL statement.
CREATE USER 'francis'@'localhost' IDENTIFIED BY 'frank';
GRANT ALL ON customer.* TO 'francis'@'localhost'
WITH MAX_QUERIES_PER_HOUR 20
To change global connection settings, you can either modify the /etc/my.cnf file with the following line:
max_connections = 250
or, run the following query.
SET GLOBAL max_connections = 100
Add a comment to this document
Do you have a helpful tip related to this document that you'd like to share
with other users? Please add it below. Your name and tip will appear at the
end of the document text.