$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:
ÿþ-
(bunch of random symbols like its a compiled file)
ÿþ
is the Byte Order Mark of a file encoded in little-endian Unicode format. 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
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.