I use this:
echo "use $DBNAME;" >backup.sql
echo "" >>backup.sql
mysqldump -h $DBHOST -P $DBPORT -u $DBUSER -p$DBPASSWORD --opt $DBNAME
>>backup.sql
gzip -f backup.sql
This added bit at the top of the file allows me to rebuild the database
from scratch just by importing the file.
George
Phil Mattison wrote:
>
> Hello Fellow PLUGers,
> I have a Linux server running Apache/PHP/MySQL, and want to setup
> automatic daily backups for the database. I'm planning to install a second
> hard drive to receive the backup data, and will modify the web site to
> exclude access while backups occur. I'm wondering if anyone has written
> scripts to do similar tasks and would be willing to share some examples. I'm
> thinking the script needs to do something like the following:
> Stop MySQL
> Copy the database files to the backup drive
> Restart MySQL
> It also would be nice to get a daily report of disk usage and the size of
> the backups. If anyone has any tips or examples they would be much
> appreciated.
> Thanks,
> --
> Phil Mattison
> Ohmikron Corp.
> 480-722-9595
> 602-820-9452 Mobile
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
--
Irrefutable fact about projects: You can have
it Quick, Cheap, or Right - pick any two.
What does that tell you if your project is ahead of schedule and under
budget?