Install the mysql tuner to tune the mysql service to avoid any memory usage due to incorrect settings in the /etc/my.cnf file.
Login in to the server as root user and download the mysqltuner.pl file
root@linux7802 [~]# cd /usr/local/src/
root@linux7802 [/usr/local/src]# wget -O mysqltuner.pl mysqltuner.pl
root@linux7802 [/usr/local/src]# perl mysqltuner.pl
Above command will give you the statistics as well as recommendations to improve the server perfomance
Refer to the following image to example of statistics
For recommendations example refer to the following image and made the necessary changes in the /etc/my.cnf file and retest the script to check, if issue resolved or not……
Note : Most of the time it recommend to optimize the mysql at that time use the following command but make sure that you have talen backup for the /var/lib/mysql directory to avoid any problem.
mysqlcheck –optimize -A



