Fix mysql restoration

Password and database weren't passed to the mysql command
This commit is contained in:
IamTheFij 2023-08-02 14:58:26 -07:00
parent 0de267a4cf
commit 1d6957f45f
2 changed files with 6 additions and 2 deletions

View File

@ -165,7 +165,11 @@ func (t JobTaskMySQL) GetPostTask() ExecutableTask {
} }
if t.Password != "" { 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) command = append(command, "<", t.DumpToPath)

View File

@ -163,7 +163,7 @@ func TestJobTaskSql(t *testing.T) {
" --user user --password=pass --no-tablespaces db table1 table2", " --user user --password=pass --no-tablespaces db table1 table2",
postBackup: "", postBackup: "",
preRestore: "", preRestore: "",
postRestore: "mysql --host host --user user --password pass < ./simple.sql", postRestore: "mysql --host host --user user --password=pass db < ./simple.sql",
}, },
// Sqlite // Sqlite
{ {