Browse Source

fix: 本地数据备份命令增加 --default-character-set 参数 与备份还原的编码保持一致

pull/2983/head
hzz 1 year ago committed by ssongliu
parent
commit
7e6c39bb08
  1. 2
      backend/utils/mysql/client/local.go

2
backend/utils/mysql/client/local.go

@ -220,7 +220,7 @@ func (r *Local) Backup(info BackupInfo) error {
}
outfile, _ := os.OpenFile(path.Join(info.TargetDir, info.FileName), os.O_RDWR|os.O_CREATE, 0755)
global.LOG.Infof("start to mysqldump | gzip > %s.gzip", info.TargetDir+"/"+info.FileName)
cmd := exec.Command("docker", "exec", r.ContainerName, "mysqldump", "-uroot", "-p"+r.Password, info.Name)
cmd := exec.Command("docker", "exec", r.ContainerName, "mysqldump", "-uroot", "-p"+r.Password, "--default-character-set="+info.Format, info.Name)
gzipCmd := exec.Command("gzip", "-cf")
gzipCmd.Stdin, _ = cmd.StdoutPipe()
gzipCmd.Stdout = outfile

Loading…
Cancel
Save