Add script that dumps out all MySQL databases managed by Plesk

This commit is contained in:
Dennis Potter 2023-05-18 22:47:57 -07:00
parent 74e3f9c677
commit b010f17c9e
Signed by: Dennis
GPG Key ID: 186A8AD440942BAF

View File

@ -0,0 +1,13 @@
#!/bin/bash
# Source of script:
# https://support.plesk.com/hc/en-us/articles/12377216464279-How-to-back-up-all-MySQL-databases-via-a-command-line-interface-in-Plesk-for-Linux
# Create a directory where backup files will be stored
mkdir -p /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