MySQL - Shell script to optimize all tables

Usage: mysql_tables.sh --optimize MyDatabaseABC

3 comments

3 Comments:

At 8:14 AM, Blogger marcel.white@removegmail.com said...

Thanks dude,

just saved me some time :)

Marcel

 
At 12:04 AM, Blogger Matej said...

ehm, just try:

echo "show tables;" |mysql $DBNAME --skip-column-names

 
At 2:18 PM, Blogger test said...

or you can do it in one line -- like this:

mysql database -e "show tables;" | awk '{print "optimize table database." $1}' | xargs -n 1 mysql -e

 

Post a Comment



Home