Solution to empty backup file generated by mysqldump scheduled task

Problem: after writing a mysqldump backup script and executing it directly, the backup file can be generated normally, but the backup file generated when running a scheduled task is empty


Analysis reason: since mysqldump exists under the bin of the global environment variable mysql, the mysqldump command can be recognized when running directly, but the mysqldump command cannot be recognized in the scheduled task. (PS: crontab running failure is basically caused by environment variables)

Solution: just add the absolute path before the mysqldump command


Similar Posts: