Question

MySQL using high CPU

Hello,

I have a problem with the MySQL service. I’m looking at “Load Averages” and there is a process with mysql owner.

It is using CPU %100 over. I’m doing kill that. It coming again after 5 seconds. What is the problem?

I’m getting the error when I try to restart MySQL. You can see error message below.

Startup Log Apr 14 14:33:23 server.display-sales.de systemd[1]: Starting MariaDB 10.3.22 database server… Apr 14 14:33:23 server.display-sales.de mysqld[5598]: 2020-04-14 14:33:23 0 [Warning] option ‘table_open_cache’: unsigned value 1073741824 adjusted to 1048576 Apr 14 14:33:23 server.display-sales.de mysqld[5598]: 2020-04-14 14:33:23 0 [Warning] option ‘table_definition_cache’: unsigned value 1073741824 adjusted to 2097152 Apr 14 14:33:23 server.display-sales.de mysqld[5598]: 2020-04-14 14:33:23 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB) starting as process 5598 … Apr 14 14:33:23 server.display-sales.de mysqld[5598]: 2020-04-14 14:33:23 0 [Warning] Could not increase number of max_open_files to more than 10000 (request: 2097337) Apr 14 14:33:23 server.display-sales.de mysqld[5598]: 2020-04-14 14:33:23 0 [Warning] Changed limits: max_open_files: 10000 max_connections: 150 (was 150) table_cache: 4910 (was 1048576) Apr 14 14:33:25 server.display-sales.de systemd[1]: Started MariaDB 10.3.22 database server.

Can you help?

Thanks Best regards, Koray ONELKE

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @wcshop,

The error

 [Warning] Could not increase number of maxopenfiles to more than 10000 (request: 2097337)

means the limit is being hit somewhere. Let’s resolve that by editing any configured limits. The limits for the MySQL service are defined in the Systemd configuration file, which you should copy from its default location into /etc/systemd and then edit the copy.

sudo cp /lib/systemd/system/mysql.service /etc/systemd/system/ sudo vim /etc/systemd/system/mysql.service # or your editor of choice Add the following lines to the bottom of the file:

LimitNOFILE=2500000 LimitMEMLOCK=2500000

Now reload the Systemd configuration with:

sudo systemctl daemon-reload

Restart MySQL and it should now obey the max_connections directive and your MySQL should start without a problem.

Regards, KDSys