Improve MySQL/MariaDB Performance With MySQLTuner

MySQLTuner is a Perl script that will analyze the performance of the MySQL/MariaDB database, and from the results of the analysis, MySQLTuner will recommend which variables should be increased or decreased, in order to increase performance. That way, we can “tune” the my.cnf file so that the MySQL/MariaDB database server performance is more optimal and works more efficiently.

First of all we download the MySQLTuner file with the command:


Then we first chmod so that it can be run:

chmod +x

Then we run MySQLTuner with the command:


NOTES: You must be logged in as root to run the above command.

The output of the above command, for example, is as follows:

server1:~# ./

 >>  MySQLTuner 0.9.8 - Major Hayden 
 >>  Bug reports, feature requests, and downloads at
 >>  Run with '--help' for additional options and output filtering
Please enter your MySQL administrative login:  16M)
    tmp_table_size (> 32M)
    max_heap_table_size (> 16M)
    table_cache (> 64)


Look at the bottom of the output that says “Recommendations“, where are the recommendations and variables you should change to improve MySQL/MariaDB performance.

Open file my.cnf at location /etc/mysql/my.cnf and change the variables according to the recommendations. When finished restart MySQL/MariaDB with the command

service mysql restart

Periodically check the performance of MySQL/MariaDB with MySQLTuner, at least once every 24 hours you run this script.

Share on


Share on


Share on


Share on


Share on



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *