0

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'"

1

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.

  • 1
    For non-Windows, use cron. – Rick James Jul 7 '20 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.