Take bakcup of single db
plesk db dump ptcindia_db_v1 > /var/www/vhosts/ptcindia.com/jeevan/ptcinddb.sql
To restore a database from this dump, run this command:
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin db_example < /path/to/database_dump
-Connect to a server via SSH.
Create a directory where backup files will be stored:
mkdir /root/mysql_dumps_all
Get a list of all databases:
cd /root && /usr/sbin/plesk db -e "show databases" | grep -v -E "^Database|information_schema|performance_schema|phpmyadmin" > dblist.txt
Create a dump of each MySQL database:
cat /root/dblist.txt | while read i; do /usr/sbin/plesk db dump "$i" > /root/mysql_dumps_all/"$i".sql; done
List all database dumps:
ls -l /root/mysql_dumps_all
To restore all databases from dump files created above, run the command:
for i in `cat /root/dblist.txt`; do MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin < /root/mysql_dumps_all/"$i".sql; done
|