зеркало из https://github.com/github/vitess-gh.git
Merge pull request #788 from enisoc/mysql_upgrade
Fix mysql_upgrade again.
This commit is contained in:
Коммит
eb29d20c2d
|
@ -148,6 +148,7 @@ func (mysqld *Mysqld) RunMysqlUpgrade() error {
|
||||||
"--defaults-file=" + mysqld.config.path,
|
"--defaults-file=" + mysqld.config.path,
|
||||||
"--socket", mysqld.config.SocketFile,
|
"--socket", mysqld.config.SocketFile,
|
||||||
"--user", mysqld.dba.Uname,
|
"--user", mysqld.dba.Uname,
|
||||||
|
"--force", // Don't complain if it's already been upgraded.
|
||||||
}
|
}
|
||||||
if mysqld.dba.Pass != "" {
|
if mysqld.dba.Pass != "" {
|
||||||
// --password must be omitted entirely if empty, or else it will prompt.
|
// --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 := exec.Command(name, args...)
|
||||||
cmd.Env = []string{os.ExpandEnv("LD_LIBRARY_PATH=$VT_MYSQL_ROOT/lib/mysql")}
|
cmd.Env = []string{os.ExpandEnv("LD_LIBRARY_PATH=$VT_MYSQL_ROOT/lib/mysql")}
|
||||||
stderr, err := cmd.StderrPipe()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
log.Infof("mysql_upgrade output: %s", out)
|
||||||
return nil
|
return err
|
||||||
}
|
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start will start the mysql daemon, either by running the 'mysqld_start'
|
// Start will start the mysql daemon, either by running the 'mysqld_start'
|
||||||
|
|
Загрузка…
Ссылка в новой задаче