Solve the problem that mysql occupies 100% of cpu resources. A Win2003 server ran a tomcat instance and didn't use nginx as a front-end proxy. This tomcat contains many websites, however, the traffic volume is not very large, and it is basically a concentrated business type. The solution process is actually quite easy. Let's record the ideas here. Www.2cto.com first upgrades the mysql server to the latest version, and tries to avoid mysql problems. In my. ini, configure "slow-query-log = 1slow-query-log-file = slow. log" in "mysqld" to restart mysql. All "slow" logs will be recorded in the log. Www.2cto.com and then when it is slow, you can see what SQL statements have caused the slow problem (slow. log in datadir). Finally, we found that the username in the slow Table query is not indexed and the concurrency is not small, and there is no problem with not much data at the beginning, later, when the data volume reached tens of thousands of times, the number of tables with no indexes found at the same time became a problem. It was terrible to compare strings with tens of thousands of times each time. Adding an index to this field immediately reduces the cpu usage.