MySQL my.cnf recommended optimization

Created:

MySQL my.cnf recommended optimization

MySQL configuration by default comes with general configuration that can be optmized for specific configuration. In this tutorial we briefly describe the most important recommended MySQL performace optimization.

You should optimize MySQL according to how much ram you have on your server.

All changes must be made on : /etc/mysql/my.cnf

Almost every Linux distros will include an example config file. Usually examples are located in /usr/share.doc/mysql-server-XXX/examples, where XXX is the current version installed.

Files are:

my-small.cnf.gz

my-medium.cnf.gz

my-large.cnf.gz

my-huge.cnf.gz
  • my-small.cnf: is good for systems with extremely small memory ( under 64MB! ).
  • my-medium.cnf: is good for systems up to 128MB of memory.
  • my-large.cnf: is good for systems with 512MB of memory.
  • my-huge.cnf: is good for systems with 1-2GB of memory or more, with most dedicated for mysql.

MySQL has some tool like mysqltuner.pl or tuning-primer.sh, which will assit you you with your MySQL configuration and make recommendations for increased performance. You should test you configuration on virtual machines and tune it up to the point everything will work as expected. A good practice is to have memory footprint under 60% of total system memory.