Automatically optimize all tables in a MySQL database
Posted by webdigity on June 9, 2006
Use this script preferably with a cronjob to automatically optimize all the tables in your mysql databases. Under root privilleges the script will search for all the databases in your server and will optimize them all. Hope you will like it as it took me more than 3 hours to write it
Optimize all databases/tables in MySQL
For more tutorials you can refer here
August 28, 2006 at 6:18 pm
Thanks for sharing that.
Very usefull script
August 29, 2006 at 11:53 am
No worries
I will try to post more usefull stuff later.
September 3, 2006 at 6:16 pm
Why are you don’t use mysqlcheck application? I think it will be easier to run this program from crontab with appropraite option. MOre detail are here:
http://dev.mysql.com/doc/refman/5.0/en/mysqlcheck.html
September 4, 2006 at 6:46 am
mysqlcheck is a little slow, but the most important is that it can break tables that have unicode charsets.
Anyway this script optimizes only tables that want optimization, while the mysqlcheck optimizes everything.
September 6, 2006 at 1:00 am
Are you kidding me with the code coloring?
September 6, 2006 at 8:44 am
If you can’t read it, just copy/paste it somewhere my friend
September 19, 2006 at 6:10 pm
Works beautifully. Implemented on all of my servers. Thanks.
January 21, 2007 at 10:21 pm
Thanks.
I’ve found mention of how one should run a FLUSH TABLES after optimizing one’s db.
Yes/No?
Thanks,
-drmike
January 22, 2007 at 12:14 am
Why to flush tables after the optimizing process?
January 29, 2007 at 7:33 pm
[...] code for the most part comes from here with some modifications made by myself to allow for the WPMu system. Instructions are included [...]
January 29, 2007 at 7:35 pm
[...] code for the most part comes from here with some modifications made by myself to allow for the WPMu system. Instructions are included [...]
February 23, 2007 at 5:12 pm
This is exactly the piece of kit I was looking for. Thank you!
March 24, 2007 at 12:21 pm
Schweet script. Fast. Thank you for writing it.
–machiner
June 9, 2007 at 3:13 pm
Automatically optimize all tables in a MySQL database
[...]Use this script preferably with a cronjob to automatically optimize all the tables in your mysql databases. Under root privilleges the script will search for all the databases in your server and will optimize them all.[...]
June 15, 2007 at 4:22 am
[...] Automatically optimize all tables in a MySQL database « Webdigity - Thoughts on SEO and Web develop… optimize - a script for running it automatically (tags: howto mysql optimization php script wordpress) [...]
October 3, 2007 at 7:44 am
I have implemented this script on one of my blogs, thanks very much