diff --git a/tasks.go b/tasks.go index 61fdbf9..e951fc9 100644 --- a/tasks.go +++ b/tasks.go @@ -165,7 +165,11 @@ func (t JobTaskMySQL) GetPostTask() ExecutableTask { } if t.Password != "" { - command = append(command, "--password", t.Password) + command = append(command, fmt.Sprintf("--password=%s", t.Password)) + } + + if t.Database != "" { + command = append(command, t.Database) } command = append(command, "<", t.DumpToPath) diff --git a/tasks_test.go b/tasks_test.go index c628c34..0706c39 100644 --- a/tasks_test.go +++ b/tasks_test.go @@ -163,7 +163,7 @@ func TestJobTaskSql(t *testing.T) { " --user user --password=pass --no-tablespaces db table1 table2", postBackup: "", preRestore: "", - postRestore: "mysql --host host --user user --password pass < ./simple.sql", + postRestore: "mysql --host host --user user --password=pass db < ./simple.sql", }, // Sqlite {