In this tutorial we will show you how to install and configuration of MySQLTuner on your Ubuntu server. For those of you who didn’t know, MySQLTuner is a script written in Perl that allows you to review a MySQL installation quickly and make adjustments to increase performance and stability. The current configuration variables and status data is retrieved and presented in a brief format along with some basic performance suggestions. It is really easy to use and it is recommended to analyze your Linux vps regularly in order to get the best performances.
This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation MySQLTuner on a Ubuntu server.
Install MySQLTuner on Ubuntu
Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.
sudo apt-get update
sudo apt-get upgrade
Step 2. Installing MySQLTuner.
The first way is to use the apt package manager. It is a little easier and faster way to install MySQLTuner on your server than the other one mentioned above. Since MySQLTuner is already added to the Ubuntu repositories, you can install it using the following command, Non-ubuntu guys can get it from here. It’s just a perl script:
sudo apt-get install mysqltuner
To run MySQLTuner, you can execute the command:
As a result, you should get something like this:
-------- Recommendations -----------------------------------------------------
Run OPTIMIZE TABLE to defragment tables for better performance
Reduce or eliminate unclosed connections and network issues
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries which have no LIMIT clause
Variables to adjust:
tmp_table_size (> 18M)
max_heap_table_size (> 18M)
When you run mysqltuner, it will show you a report with many suggestions. Just follow them. Exact suggestion will vary so its hard to cover all of them here. Rather I will give you some notes some of them are offered by mysqltuner itself.
Congratulation’s! You have successfully installed MySQLTuner. Thanks for using this tutorial for installing MySQLTuner to optimize your MySQL on your Ubuntu system. For additional help or useful information, we recommend you to check the official MySQLTuner web site.