Page 1 of 1

how to take all mysql database backup using script?

Posted: Fri Nov 18, 2016 11:26 am
by Ashlin
Hi,

I need to upgrade mysql ,so I need to backup all my database .Is there any bash script for backup all my database for cpanel server?

Re: how to take all mysql database backup using script?

Posted: Wed Dec 28, 2016 8:05 am
by Martin
Use the below script to take backup of all databases on the server.

mkdir /home/mysqldump
cd /home/mysqldump

root@server [~]# vi db-backup.sh

#!/bin/sh
for i in `mysql -e'show databases' | grep -v 'Database\|performance_schema\|information_schema'` ;
do
mysqldump $i > /home/mysqldump/$i.sql
done

=============================
Martin
Linux Support Engineer.
Nixtree Solutions
Managed Full Server Backups
https://www.nixtree.com/managed-backups.php
Follow us on : https://twitter.com/nixtree