Skip to content

Commit

Permalink
upgrade mysqldump's speed & output fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Cameron <[email protected]>
  • Loading branch information
JasonLovesDoggo committed Nov 3, 2024
1 parent 54d6ddf commit 4a9049b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion handlers/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ func (h *MySQLHandler) Backup(ctx context.Context) (string, error) {
timestamp := time.Now().Format("20060102_150405")
filename := filepath.Join(h.tempDir, fmt.Sprintf("mysql_%s.sql", timestamp))
cmd := exec.CommandContext(ctx, "mysqldump",
"--single-transaction",
"-h", config.Cfg.MySQL.Host,
"-P", config.Cfg.MySQL.Port,
"-u", config.Cfg.MySQL.User,
fmt.Sprintf("-p%s", config.Cfg.MySQL.Password),
config.Cfg.MySQL.Database)
config.Cfg.MySQL.Database,
"--quick",
"-r ", filename)

output, err := cmd.Output()
if err != nil {
Expand Down

0 comments on commit 4a9049b

Please sign in to comment.