From 5cb0f25c1f2bf715ead4a5bee7e0b6a958513881 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Wed, 4 Dec 2019 13:05:43 -0700 Subject: [PATCH] Force search /usr/sbin for mysqld Signed-off-by: Morgan Tocker --- go/vt/env/env.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/go/vt/env/env.go b/go/vt/env/env.go index 8571e0d05e5..dd28d1eb5c1 100644 --- a/go/vt/env/env.go +++ b/go/vt/env/env.go @@ -18,6 +18,7 @@ package env import ( "errors" + "fmt" "os" "os/exec" "path" @@ -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")