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:


wget https://raw.github.com/rackerhacker/MySQLTuner-perl/master/mysqltuner.pl

Then we first chmod so that it can be run:

chmod +x mysqltuner.pl

Then we run MySQLTuner with the command:

./mysqltuner.pl

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.pl

 >>  MySQLTuner 0.9.8 - Major Hayden 
 >>  Bug reports, feature requests, and downloads at https://mysqltuner.com/
 >>  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)

server1:~#

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

Facebook



Share on

Twitter



Share on

WhatsApp



Share on

Telegram



Share on

E-mail

.



Source link

Leave a Reply

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