简体   繁体   English

PowerShell MySQL转储脚本无法正确转储

[英]PowerShell MySQL Dump Script does not dump correctly

$d= Get-Date
$dString = $d.Year.ToString() + "-" + $d.Month.ToString() + "-" + $d.Day.ToString() + "_" + $d.Hour.ToString() + "-" + $d.Minute.ToString() + "-" + $d.Minute.ToString()
$backupFilePath = "C:\wamp\backupFileName_" + $dString + ".sql"
$cmd = "& 'C:\wamp\bin\mysql\mysql5.6.12\bin\mysqldump.exe' -u ipbform -p123123 wiki > " + $backupFilePath
Write-Host $cmd
invoke-expression $cmd | out-null

When I look at the MySQL dump file I get this: 当我查看MySQL转储文件时,我得到了这个:

ÿþ- (bunch of random symbols like its a compiled file) ÿþ- (一堆随机符号,如编译文件)

ÿþ is the Byte Order Mark of a file encoded in little-endian Unicode format. ÿþ是以小端Unicode格式编码的文件的字节顺序标记 Try this: 尝试这个:

$cmd = "& 'C:\wamp\bin\mysql\mysql5.6.12\bin\mysqldump.exe' -u ipbform -p123123 wiki"
Write-Host $cmd
Invoke-Expression $cmd | Out-File $backupFilePath -Encoding ASCII

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

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