How to Optimize MySQL
Today I found my websites were very slow. Log into linode system and I found MySQL is over 500% CPU usage.
Just google it. and found a script.
- wget https://raw.github.com/major/MySQLTuner-perl/master/mysqltuner.pl
- use winscp to change the pl file to 777
- use putty to telnet the server.
- Just run the pl. ./mysqltuner.pl
- The pl will display some setting suggestion. change ./etc/mysql/my.cnf
- Use the following command to optimize database tables
mysqlcheck –optimize -A -u username -ppassword
- service mysql restart
- That’s all.