Add script that dumps out all MySQL databases managed by Plesk
This commit is contained in:
parent
74e3f9c677
commit
b010f17c9e
13
plesk_dump_mysql_dbs/plesk_dump_mysql_dbs.sh
Executable file
13
plesk_dump_mysql_dbs/plesk_dump_mysql_dbs.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user