本文介绍了无法将"mysqldump"识别为内部或外部命令可操作程序或批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试创建一个批处理,以使用任务计划程序备份MySQL数据库.

I have been trying to create a batch to backup MySQL database using task scheduler..

FOR /F "tokens=1-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%F%%G%%H)
FOR /F "tokens=1-4 DELIMS=: " %%F IN ('time /T') DO (set v_time=%%F%%G%%H)
set fname=database_backup_%v_date%_%v_time%.sql
echo %v_time%
echo %fname%
set desfolder=C:\backup
set desfolder1=D:\backup
echo %desfolder%
echo %desfolder1%

mysqldump --add-drop-table -u root -pxxxx xxxx>%desfolder%\%fname%
mysqldump --add-drop-table -u root -pxxxx xxxx>%desfolder1%\%fname%
pause

这个特定的代码在XP上工作正常,但是在进入Windows任务计划时,出现以下错误:

This particular code worked fine for XP but when coming to Windows task schedule I get the following error:

mysqldump' is not recognized as an internal or external command operable program or batch file

但是如果手动操作它会很好

but if operate it manually it works fine

推荐答案

您的路径中是否有mysqldump?

Do you have mysqldump in your path?

任何一个

  1. 将其添加到路径,请参见 http://dev.mysql.com/doc/mysql-windows-excerpt/5.1/en/mysql-installation-windows-path.html

在脚本内将完整路径添加到mysqldump

Add the full paths to mysqldump within the script

这篇关于无法将"mysqldump"识别为内部或外部命令可操作程序或批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 19:49