Merge pull request #788 from enisoc/mysql_upgrade

Fix mysql_upgrade again.
This commit is contained in:
Anthony Yeh 2015-06-11 23:36:27 -07:00
Родитель e8a90ef1f3 80f7568bd4
Коммит eb29d20c2d
1 изменённых файлов: 4 добавлений и 21 удалений

Просмотреть файл

@ -148,6 +148,7 @@ func (mysqld *Mysqld) RunMysqlUpgrade() error {
"--defaults-file=" + mysqld.config.path,
"--socket", mysqld.config.SocketFile,
"--user", mysqld.dba.Uname,
"--force", // Don't complain if it's already been upgraded.
}
if mysqld.dba.Pass != "" {
// --password must be omitted entirely if empty, or else it will prompt.
@ -155,27 +156,9 @@ func (mysqld *Mysqld) RunMysqlUpgrade() error {
}
cmd := exec.Command(name, args...)
cmd.Env = []string{os.ExpandEnv("LD_LIBRARY_PATH=$VT_MYSQL_ROOT/lib/mysql")}
stderr, err := cmd.StderrPipe()
if err != nil {
return nil
}
stdout, err := cmd.StdoutPipe()
if err != nil {
return nil
}
go func() {
scanner := bufio.NewScanner(stderr)
for scanner.Scan() {
log.Infof("mysql_upgrade stderr: %v", scanner.Text())
}
}()
go func() {
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
log.Infof("mysql_upgrade stdout: %v", scanner.Text())
}
}()
return cmd.Run()
out, err := cmd.CombinedOutput()
log.Infof("mysql_upgrade output: %s", out)
return err
}
// Start will start the mysql daemon, either by running the 'mysqld_start'