Skip to content

Commit

Permalink
Merge pull request #5506 from planetscale/morgo-fix-sbin
Browse files Browse the repository at this point in the history
Force search /usr/sbin for mysqld
  • Loading branch information
morgo authored Dec 10, 2019
2 parents 46a607e + 5cb0f25 commit f517d52
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion go/vt/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package env

import (
"errors"
"fmt"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -70,7 +71,11 @@ func VtMysqlRoot() (string, error) {
return root, nil
}

// otherwise let's use the mysqld in the PATH
// otherwise let's look for mysqld in the PATH.
// ensure that /usr/sbin is included, as it might not be by default
// This is the default location for mysqld from packages.
newPath := fmt.Sprintf("/usr/sbin:%s", os.Getenv("PATH"))
os.Setenv("PATH", newPath)
path, err := exec.LookPath("mysqld")
if err != nil {
return "", errors.New("VT_MYSQL_ROOT is not set and no mysqld could be found in your PATH")
Expand Down

0 comments on commit f517d52

Please sign in to comment.