MySQL – Shell script to optimize all tables
January 29th, 2007 by admin

Usage: mysql_tables.sh –optimize MyDatabaseABC


6 Responses  
  • marcel.white@removegmail.com writes:
    April 3rd, 20073:14 pmat

    Thanks dude,

    just saved me some time :)

    Marcel

  • Matej writes:
    October 4th, 20077:04 amat

    ehm, just try:

    echo “show tables;” |mysql $DBNAME –skip-column-names

  • test writes:
    March 29th, 20089:18 pmat

    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

  • don't even bother writes:
    October 30th, 20082:59 pmat

    Mr.test’s script works but missing some quotes…

    mysql database -e “show tables;” | awk ‘{print “\”optimize table database.” $1 “\””}’ | xargs -n 1 mysql -e

  • massl writes:
    December 31st, 200812:14 pmat

    just try:

    mysqlcheck –optimize -A

    that should do the job as well, and a bit less code :P

  • Wim writes:
    June 13th, 200912:01 pmat

    Massl, and how the repair ?


Leave a Reply

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

»  Substance:WordPress   »  Style:Ahren Ahimsa