To change this settings, you should edit your
my.cnf and update them in the
mysqld section. See the MySQL System Variables manual page for more information. Please remember to keep a good working backup of your previous
my.cnf. Better yet, include your
my.cnf in your source control tree. I assume that you already have tested backups of your data...
So, do this steps:
- run the tunning-primer.sh script to see how well is your server doing (or not);
- read the MySQL Performance blog articles, specially the article about choosing
- make sure you don't double-cache with
- make sure Linux is not swapping out your memory "just because":
echo 0 > /proc/sys/vm/swappiness
echo 'vm.swappiness = 0' >> /etc/sysctl.conf
These are the basic settings that I pay attention to. Of course there is much much more settings that you can tune (
innodb_flush_log_at_trx_commit come to mind), but the things above will cover most of what you need.
After this, you should also use the
mysqlreport tool. It requires more investment on your part, understanding the data, but its very thorough.
Finally, install Maatkit and get used to the tools it provides. They are essential if you are using replication.