MySQL backup sript – more info


Here’s my script to backup mysqlTo install it on a linux/freebsd box just edit the top parts for configuration. If you make a user mysqldump with home directory of /home/mysqldump and a mysql password of p@assword, make a /home/mysqldump/logs and /home/mysqldump/bkup directories, this should just work. Hack it up, it’s GPL’d.

Please email me updates you make and I will post them here. My email is kgb@bluesun.netThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it

More “in depth” installation:

adduser mysqldump
passwd mysqldump
mysql -p
GRANT select,lock tables on *.* to mysqldump@localhost identified by ‘p@ssword’;
flush privileges;
su – mysqldump
mkdir ~/bin
mkdir ~/logs
mkdir ~/bkup
cd ~/bin
wget http://www.submarinefund.com/backup_mysql/backup_mysql
chmod u+x backup_mysql
vi backup_mysql
make changes to config
– change passwd to the same one you used on the
GRANT instead of p@ssword
– change num_days_keep to the number of days you want to keep around

– change all the commands to match your system, these
should be the same on most linux systems, BSD’s may
need to change some paths

test the script

add a line to your crontab like this
0 3 * * * /home/mysqldump/bin/backup_mysql >> /home/mysqldump/logs/cron.log 2>&1

script gzipped

script txt

script zip zipped

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

, ,

Easy AdSense by Unreal