There are two linux tuning scripts I would recommend to anyone who wants to tweak MySQL installation for the best possible performance.
One of them is MySQL Tuner Primer with download located at this page: https://launchpadlibrarian.net/78745738/tuning-primer.sh.
Another one is called MySQL Tuner which is available for download from following url: https://raw.github.com/rackerhacker/MySQLTuner-perl/master/mysqltuner.pl
Both of these scripts will basically do the same thing, run a performance test and then output my.cnf changes in order to achieve the best performance.
Please note, that in order to get the good recommendations, your MySQL server should be running for at least 1-2 full days and have enough data.
This is how you install and execute each of these scripts.
First, we need to install BC. This is how you can do this in CentOS/RedHat:
yum install bc -y
Then download both scripts, execute following commands:
Then execute MySQL Tuner Primer:
Look at the recommendations!
Now try to run MySQL Tuner:
Again, look at the recommendations and based on output from above scripts adjust my.cnf, then reboot MySQL.