Mysql – Event and thesqldump

backupMySQLmysql-event

I am trying to create an event for automatic backup using this code

DELIMITER $$
CREATE EVENT IF NOT EXISTS e_AutomaticBackUp1Day
ON SCHEDULE AT 1 Day STARTS '2020-07-06 10:13:00'
DO
BEGIN
mysqldump -u user -p password dbname > E:BackUp.sql
END

$$

But I am getting an error "ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'day STARTS '2020-07-06 10:13:00'"

Best Answer

mysqldump isn't a SQL statement but utility intended to be invoked from the OS command line.

If you want your DBs to be dumped on the schedule basis you have to create the mydump.CMD batch file and then to add this batch-file invocation in the windows scheduler. I see the E:Backup.sql path that is definitely windows-specific.