简体   繁体   English

任务计划程序Windows 7 MySQL中出现0x2错误

[英]0x2 error in task scheduler windows 7 mysql

I'm trying to do mysql batabase dump periodically through task scheduler. 我正在尝试通过任务计划程序定期进行mysql batabase转储。 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. 但是,当我通过Task Scheduler运行时,它不起作用。

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 任务计划程序错误-0x2错误屏幕截图 在此处输入图片说明

Task Action Definition Screen Print 任务操作定义屏幕打印 在此处输入图片说明

make .bat file, let say c:\\xampp\\mysql\\bin\\backup.bat and execute it from scheduller. 制作.bat文件,假设c:\\ xampp \\ mysql \\ bin \\ backup.bat并从scheduller执行。 put into .bat file this commands: 将以下命令放入.bat文件:

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 另外,请阅读以下内容: 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. Windows Server 2008 R2和更高版本以及Windows Vista和更高版本中的任务计划程序默认情况下在“最低特权”安全上下文下执行任务。

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. 这将覆盖默认的“最小特权”行为,并允许任务以管理特权运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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