You can make use of the following script to generate a backup of all the databases and also restoring the DB from the available backup in cPanel owned by a particular user.

=============

#!/bin/bash
cd /var/lib/mysql
ls -al | grep username | awk {‘print$9’} > dblist
for i in `cat dblist`
do
mysqldump $i > $i.sql;
mv $i.sql /home/username
done
cp /backup/cpbackup/monthly/username/mysql/yogabook_*.sql /var/lib/mysql
for i in `cat dblist`
do
mysql $i < $i.sql;
done
=============
Have a Great Day 🙂 🙂

Leave a Reply

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny