Resolve MySQL database connection too much, most sleep

Source: Internet
Author: User

1. View details of all current connections: Mysqladmin-uroot-proot processlist client use: Show full processlist2, view only the current number of connections (threads is the number of connections.): Mysqladmin-uroot-The proot status client uses:3. View the maximum number of connections show variables like"Max_connections";4: View current number of connections: Show global status like' Max_used_connections '; If the process prints out too much: MySQL-E ' show full processlist; ' > 111Workaround: SHOW GLOBAL VARIABLES like' Wait_timeout '; SHOW GLOBAL VARIABLES like' Interactive_timeout '; set global Wait_timeout=100; SET GLOBAL interactive_timeout=100; Modify the connection wait time to release the connection over time. The above is a real-time modification after restarting the database can be added in my.cnf wait_timeout=100Interactive_timeout=100looking again may find that the succession cannot be released. The database needs to be restarted. Shutdown mysqld may fail. Always............................................................................................. Restart the server. The "Bay stretched out" MySQL database is unresponsive. Can only be forced to restart the maximum number of connections (not recommended): MySQL server in the past the maximum number of connections is 245, did not reach the maximum number of server connections 256, there should be no 1040 error, the more ideal setting is: Max_used_connections/max_connections * 100%≈85%temporarily Modify set GLOBAL max_connections=1000; Permanent modification: Configuration/etc/My.cnf[mysqld] Add a new line with the following parameters: Max_connections=1000Show variables like' Max_connections ';
If not we view the maximum of 1000; This is due to the default number of open files limit for mariadb. Can be configured by/usr/lib/systemd/system/Mariadb.service to increase the number of open files. Configuration/usr/lib/systemd/system/Mariadb.service[service] Add two new lines to the following parameters: Limitnofile=10000Limitnproc=10000Reload the system service and restart the MARIADB service Systemctl--system daemon-Reload systemctl Restart Mariadb.service

Resolve MySQL database connection too much, most sleep

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.