Tuesday, September 17, 2013

MYSQL:Scripts for MYSQL Databases hotbackuup

MYSQL Databases backup


MYSQL provide the utility for hot backup that can be done by mysqldump

1.For Backup of single database in shell script

/usr/local/mysql/bin/mysqldump  -uroot -ppass --log-error=/mysql2/mysqlbackup/db_name_`date +"%d-%m-%y"`.log DBNAME --routines >/mysql2/mysqlbackup/DBNAME_`date +"%d-%m-%y"`.sql

2.For All MYSQL Databases backup in one single file.

/usr/local/mysql/bin/mysqldump -u root -p --log-error=/mysql2/mysqlbackup/ALL_DB_ERROR_`date+"%d-%m-%y"`.log  --all-databases --routines >/mysql2/mysqlbackup/ALL_MYSQL_DB_`date +"%d-%m-%y"`.sql

Use mysqlimport to restore backup.
 

No comments:

Post a Comment

Dear User,

Thank you very much for your kind response