I've used a simply shell script in the past.. run from cron to do it...
I just see someone posted a perl solution.. I've used a php one aswell..


#!/bin/sh
# DB OPTIMIZE SCRIPT - !! WARNING, DOES TABLE LOCKING DURING OPTIMIZES
user=root
pass=secret
host=10.1.1.1
db=mydb
[EMAIL PROTECTED]
mysql="/usr/local/bin/mysql "

## BUILD TABLE LIST
flag=0
for table in \
`echo show tables|$mysql --host=$host --user=$user --password=$pass $db |
tail +2` ; \
do \
  if test $flag == 1
  then
    dblist="$dblist,"
  fi
  dblist="$dblist $table"
  flag=1
done

## RUN OPTIMIZE
echo optimize table $dblist|$mysql --host=$host --user=$user
--password=$pass $db >> /tmp/db_optreport ; \

mail -s "Nightly DB Optimize" $report < /tmp/db_optreport
rm /tmp/db_optreport




On Tue, 3 Jun 2003, Mark Stringham wrote:

> Hi -
>
> Can anyone give the command line syntax for optimizing the entire db?
> thanks in advance.
>
> MS
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to