This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23001|Reply: 1

[Source] Docker MySQL solves the problem of too many connections

[Copy link]
Posted on 10/8/2021 10:33:06 AM | | | |
The MySQL database is deployed using a Docker container, and when the number of client connections exceeds a certain number, the error "Too many connections" will be reported.

docker mysql image address:The hyperlink login is visible.

The image I am using is mysql:5.7.34 version, max_connections the default number is 151, as shown in the image below:


Temporary solutions

To set the maximum number of connections, the sql command is as follows:


MySQL performance optimization sets max_connections maximum number of connections
https://www.itsvse.com/thread-10049-1-1.html
After restarting the docker container, the maximum number of connections is reset to the default of 151

Thorough solution

Modify the /etc/mysql/mysql.cnf configuration file in the container and use the following command to copy the files in the container to the host machine:


Modify the mysql.cnf file using the vim command as follows:

Copy the host's files into the container with the following command:


Restart the mysql container, and query the maximum number of connections through the SQL command, which shows the value we configured.

(End)




Previous:RAID Technology Explained - RAID0, RAID1, RAID3, RAID5, RAID6, RAID10 comparison
Next:Completely solve the problem of win10 Ethernet no Internet (can access the Internet normally).
Posted on 10/8/2021 8:59:42 PM |
Another week has passed, let's take a look again
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com