I would like some tips on how to back up a mysql database with Event Scheduler.
I just got in my searches, find event to back individual tables. I would like to be able to backup the whole database, can anyone help me?
(this code is just a test I'm doing on localhost)
SET @sql_text =
CONCAT (
"SELECT * FROM ?i dont know? INTO OUTFILE 'C:\Users\Eiglimar\Desktop\backup_mysql"
, DATE_FORMAT( NOW(), '%Y%m%d')
, "BonInterne.csv'"
);
PREPARE s1 FROM @sql_text;
delimiter |
CREATE EVENT BackUpCSV
ON SCHEDULE EVERY 1 MINUTE
STARTS CURRENT_TIMESTAMP + INTERVAL 1 DAY
ENDS CURRENT_TIMESTAMP + INTERVAL 1 YEAR
DO
BEGIN
EXECUTE s1;
END |
delimiter ;
DROP PREPARE s1;