mysql.exe -uuser -ppassword -s -N -e "SHOW DATABASES" | for /F "usebackq" %%D in (`findstr /V "information_schema performance_schema"`) do mysqldump %%D -uuser -ppassword > C:\MysqlBackup\%%D.sql
Save it as a .bat file.
Schedule it via Task Scheduler.
Don't know where I originally found it, but it works great.
This script loops through all databases. Any future databases added to MySQL will automatically become protected.
Prerequisite! You need to add this inside the system environment variable called Path:
Code: Select all
C:\Program Files\MySQL\MySQL Server 8.0\bin