How to optimize MySQL database with a command
When you delete large portions for data from your MySQL table, the database becomes more fragmented. It is always a good idea to re-optimize your MySQL database especially if you have a lot of varying characters (VARCHAR). Here’s the command to optimize just one table:
But I am looking for a more command line solution and here it is:
The ‘o’ refers to optimize. And the ‘p’ is the option for password requirement. You’ll be prompted for the password.
If you’re logged in as user ‘john’ in your SSH, the MySQL username will be ‘john’. If that’s not what you want, use option ‘u’ like this:
And to optimize all databases:
You can also use option ‘r’ to repair.
Note that the optimization only works for MyISAM, InnoDB, and ARCHIVE tables.
Possibly related:
great idea for a cron script.
Mar 05
Thanks for very good article .its help to optimize my database.thanks again
Dec 19
thanks! helped allot
if you are reading this, you will probably be interesting in:
http://www.mydigitallife.info/2008/07/29/mysql-database-performance-tuning-best-practices-video-tutorial/
and this one too:
http://blog.mysqltuner.com/
Feb 12