今天尝试在windows平台自动备份mysql数据库,create一个脚本dbbak.bat,内容如下:
net stop mysql
xcopy D:\Program files\MySQL\MySQL Server5.0\data\mysql\*.* D:\MySQL\mysql_bak\BakData\%date:~0,3%\ /y
net start mysql
在scheduled tasks中把dbbak.bat添加之后等待其运行,可是时间过了,系统显示也运行过了,可是数据库并没有被备份。后在cmd模式下运行
C:\Documents and Settings\John Zhang>xcopy D:\Program files\MySQL\MySQL Server5.0\data\mysql\*.* D:\MySQL\mysql_bak\Bak
Data\%date:~0,3%\ /y
Invalid number of parameters
C:\Documents and Settings\John Zhang>D:\Program files\MySQL\MySQL Server5.0\data\mysql\*.*
'D:\Program' is not recognized as an internal or external command,
operable program or batch file.
这才意识到cmd模式下是通过空格来分隔不同参数的,不得已,最后只好把mysql卸载又重装了一遍,才解决问题。朋友们,以后一定要小心这个问题啊!
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9765498/viewspace-201838/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9765498/viewspace-201838/