简体   繁体   中英

0x2 error in task scheduler windows 7 mysql

I'm trying to do mysql batabase dump periodically through task scheduler. When I run the following query from command prompt, it gives me the dump. But, when I'm running through Task Scheduler, it's not working.

Query

C:\xampp\mysql\bin\mysqldump.exe --user=root --password=root --host=localhost --database  gm > E:\backupgmdb\gm_backup_%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.sql

Task Scheduler error - 0x2 error screenshot 在此处输入图片说明

Task Action Definition Screen Print 在此处输入图片说明

make .bat file, let say c:\\xampp\\mysql\\bin\\backup.bat and execute it from scheduller. put into .bat file this commands:

c:
cd \
cd C:\xampp\mysql\bin\
C:\xampp\mysql\bin\mysqldump.exe --user=root --password=root --host=localhost --database  gm > E:\backupgmdb\gm_backup_%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.sql

Plus, read this: https://serverfault.com/questions/734035/running-a-batch-file-from-task-scheduler-without-user-being-logged-in

The Task Scheduler in Windows Server 2008 R2 and later and Windows Vista and later executes tasks under a "least privileges" security context by default.

Open the properties of the task and check Run with highest privileges. Press OK, then enter the password for the administrative account when prompted. This will override the default "least privileges" behavior and will allow the task to run with administrative privileges.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM