MySQLTuner is a tool written in Perl which helps you increase the performance of your MySQL database server. It is really easy to use and it is recommended to analyze your Linux VPS regularly in order to get the best performances. In this tutorial we are going to show you how to install and use MySQLTuner on Ubuntu 14.04.
First of all, login to your server and perform a system upgrade. It may take a few minutes but it is crucial for your server’s security. Use the following command to upgrade all your system software to the latest version available:
sudo apt-get update && sudo apt-get -y upgrade
Once the upgrade is completed, you can proceed and install the MySQLTuner on your Ubuntu VPS. There are two easy ways to do that and we will cover both in this tutorial.
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:
sudo apt-get install mysqltuner
To run MySQLTuner, you can execute the command:
sudo mysqltuner
It could take a few moments before the MySQLTuner provides you with the final report.
The other way to install MySQLTuner is to download the script from Git. This is the preferable way since it allows you to use the latest version of the software.
Navigate to the /opt directory on your server and download the latest version of MySQLTuner:
cd /opt/ wget http://mysqltuner.pl/ -O mysqltuner.pl
Make the script executable by using the command:
chmod +x mysqltuner.pl
And finally, run the script using the command:
./mysqltuner.pl
Or, if you do not like to make the script executable by adding the execute bit, you can directly call Perl to start the program by using the following command:
perl mysqltuner.pl
As a result, you should get something like this:
-------- Recommendations ----------------------------------------------------- General 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: query_cache_type (=1) tmp_table_size (> 16M) max_heap_table_size (> 16M)
Once you get the final report and the MySQLTuner recommendations, you can make the changes to your MySQL database server settings. Of course, be careful while making the changes since you may lose some important data from your databases if something is set in a wrong way. If you are not sure about an issue, it is best to contact a MySQL expert in order to get the right answer. The best practice is to create a backup of your MySQL databases before making any changes so you can restore the databases later if something goes wrong.
Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to install MySQLTuner for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.