How to Optimize MySQL

Nov 08

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.

  1. wget https://raw.github.com/major/MySQLTuner-perl/master/mysqltuner.pl
  2. use winscp to change the pl file to 777
  3. use putty to telnet the server.
  4. Just run the pl. ./mysqltuner.pl
  5. The pl will display some setting suggestion.  change ./etc/mysql/my.cnf
  6. Use the following command to optimize database tables
    mysqlcheck –optimize -A -u username -ppassword
  7. service mysql restart
  8. That’s all.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word