Skip to content

Commit 75dfa53

Browse files
authored
Merge pull request #608 from elonzh/fix/log-password
hidden mysql password in log
2 parents 42e81ef + d93f693 commit 75dfa53

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dump/dumper.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ func (d *Dumper) Dump(w io.Writer) error {
164164
}
165165

166166
args = append(args, fmt.Sprintf("--user=%s", d.User))
167-
args = append(args, fmt.Sprintf("--password=%s", d.Password))
167+
passwordArg := fmt.Sprintf("--password=%s", d.Password)
168+
args = append(args, passwordArg)
169+
passwordArgIndex := len(args) - 1
168170

169171
if !d.masterDataSkipped {
170172
args = append(args, "--master-data")
@@ -238,7 +240,9 @@ func (d *Dumper) Dump(w io.Writer) error {
238240
}
239241
}
240242

243+
args[passwordArgIndex] = "--password=******"
241244
log.Infof("exec mysqldump with %v", args)
245+
args[passwordArgIndex] = passwordArg
242246
cmd := exec.Command(d.ExecutionPath, args...)
243247

244248
cmd.Stderr = d.ErrOut

0 commit comments

Comments
 (0)