Using MYSQL Hotbackup

Hello,

I intend to use MYSQLHotbackup , i.e mysqlhotcopy.

We have MYSQL on linux box with 2.6 version and MYSQL 5.0.22 version.

I wanted to know if MYSQL hotbackup can be done on Linux systems and the steps requierd to install.

Thanks

Yes, it works on linux. For installation and usage docs, read http://www.innodb.com/support/documentation/innodb-hot-backu p-manual/ this doc.

Hi,

I am trying to run this code:

#!/bin/sh
DBHOST=‘localhost’
DBUSER=‘root’
DBPASSWD=‘pwd’
FTPHOST=‘0.0.0.0’
FTPUSER=‘user’
FTPPASSWD=‘pwd’
LOCALDIR=/home/path/
REMOTEDIR=/var/path/
TARPREFIX=db1
cd $LOCALDIR SUFFIX=‘eval date +%y%m%d’
DBS=‘mysql -u$DBUSER -p$DBPASSWD -h$DBHOST -e"show databases"’
for DATABASE in $DBS do if [$DATABASE!=“Database”]; then FILENAME=$SUFFIX-$DATABASE.tar.gz
mysqlhotcopy -u $DBUSER -p $DBPASSWD $DATABASE $LOCALDIR tar -czf
$LOCALDIR $FILENAME $LOCALDIR $DATABASE rm -rf $LOCALDIR $DATABASE rm rf
$LOCALDIR $DATABASE -replicate fi
done
chmod 400 $LOCALDIR*.tar.gz tar -cf $TARPREFIX-$SUFFIX.tar
$SUFFIX-*.tar.gz ftp -n $FTPHOST <

But it throws me an error :

./backup.sh: line 13: syntax error near unexpected token then' ./backup.sh: line 13: for DATABASE in $DBS do if [$DATABASE!=“Database”]; then FILENAME=$SUFFIX-$DATABASE.tar.gz’

How can I correct this.

Thanks

Try to add spaces around square brackets ("]" and “[”) in your IF statement.

Nope , that did not help. Returning the same error.

for DATABASE in $DBS___;___ do

#!/bin/shDBHOST='localhost’DBUSER='root’DBPASSWD='pwd’FTPHOST='0.0.0.0’FTPUSER='user’FTPPASSWD=‘pwd’<-- You dont need to quote the values[snip]cd $LOCALDIR SUFFIX=‘eval date +%y%m%d’<-- I would recommend using $(date…)<-- With ‘’ as quoting it wouldnt work anyway<-- AFAIK (on linux) SUFFIX would “executed” in a “subshell"DBS='mysql -u$DBUSER -p$DBPASSWD -h$DBHOST -e"show databases”'for DATABASE in $DBS do if [$DATABASE!=“Database”]; then <-- for DATABASE in $DBS ; do if [ $DATABASE!=“Database” ]; then <-- as scoundrel remarkedFILENAME=$SUFFIX-$DATABASE.tar.gzmysqlhotcopy -u $DBUSER -p $DBPASSWD $DATABASE $LOCALDIR tar -czf$LOCALDIR $FILENAME $LOCALDIR $DATABASE rm -rf $LOCALDIR <-- I think the Space between $LOCALDIR and $FILENAME etc. is wrong$DATABASE rm rf$LOCALDIR $DATABASE -replicate fi<-- I think the Space between $LOCALDIR and $DATABASE is wrongdonechmod 400 $LOCALDIR*.tar.gz tar -cf $TARPREFIX-$SUFFIX.tar<-- I dont get your chmod$SUFFIX-*.tar.gz ftp -n $FTPHOST <<-- I dont get this either