{"record":{"id":"26e87e22dfcf4bfc","repo":"vitessio/vitess","slug":"could-not-auto-detect-mysql-version-v-you-may-ne","errorCode":null,"errorMessage":"could not auto-detect MySQL version: %v\nYou may need to set your PATH so a mysqld binary can be found:\n\tPATH: %s\n\tVT_MYSQL_ROOT: %s\n\tVTROOT: %s\n\tvtenv.VtMysqlRoot(): %s\n\t","messagePattern":"could not auto-detect MySQL version: (.+?)\nYou may need to set your PATH so a mysqld binary can be found:\n\tPATH: (.+?)\n\tVT_MYSQL_ROOT: (.+?)\n\tVTROOT: (.+?)\n\tvtenv\\.VtMysqlRoot\\(\\): (.+?)\n\t","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"go/vt/mysqlctl/mysqld.go","lineNumber":2319,"sourceCode":"\t\tlog.Warn(\"Running remotely through mysqlctl and thus socketFile should not be set\")\n\t}\n}\n\nfunc failVersionDetection(err error) {\n\tvtenvMysqlRoot, _ := vtenv.VtMysqlRoot()\n\tmessage := fmt.Sprintf(`could not auto-detect MySQL version: %v\nYou may need to set your PATH so a mysqld binary can be found:\n\tPATH: %s\n\tVT_MYSQL_ROOT: %s\n\tVTROOT: %s\n\tvtenv.VtMysqlRoot(): %s\n\t`,\n\t\terr,\n\t\tos.Getenv(\"PATH\"),\n\t\tos.Getenv(\"VT_MYSQL_ROOT\"),\n\t\tos.Getenv(\"VTROOT\"),\n\t\tvtenvMysqlRoot)\n\tpanic(message)\n}\n","sourceCodeStart":2301,"sourceCodeEnd":2321,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/mysqld.go#L2301-L2321","documentation":"mysqlctl cannot locate a mysqld binary to auto-detect the MySQL flavor/version. It builds a detailed diagnostic message including PATH, VT_MYSQL_ROOT, VTROOT, and vtenv.VtMysqlRoot(), then panics, since the MySQL version is required to proceed.","triggerScenarios":"mysqld is not on PATH, VT_MYSQL_ROOT points at a directory without a mysql/mysqld binary, or vtenv environment resolution fails — during mysqlctl initialization that needs the MySQL version (e.g. flavor detection for mysqlctl setup).","commonSituations":"Running vitess tools on hosts where MySQL is installed in a nonstandard location; Docker images missing mysql client/server binaries; VT_MYSQL_ROOT set incorrectly after a version upgrade.","solutions":["Install MySQL/MariaDB (mysqld) or add its bin directory to PATH","Set VT_MYSQL_ROOT to the MySQL installation root containing bin/mysqld","Verify with the printed diagnostics: check PATH, VT_MYSQL_ROOT, VTROOT, and vtenv.VtMysqlRoot() values in the panic message","Explicitly configure the flavor/version if supported instead of relying on auto-detection"],"exampleFix":"// before\nexport VT_MYSQL_ROOT=/opt/mysql-wrong\n// after\nexport VT_MYSQL_ROOT=/usr/local/mysql\nexport PATH=$VT_MYSQL_ROOT/bin:$PATH","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"mysqld\"); err != nil {\n\treturn fmt.Errorf(\"mysqld not found: set VT_MYSQL_ROOT or PATH: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify mysqld is on PATH in deployment images and hosts","Set VT_MYSQL_ROOT explicitly in provisioning scripts","Smoke-test mysqlctl version detection during environment setup"],"tags":["go","panic","mysql","environment","path","mysqlctl"],"backgroundTag":"mysqld-binary-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}