Install MySQL from official archive
This commit is contained in:
@@ -366,40 +366,41 @@ class DeployWorkbench(tk.Tk):
|
||||
if tool_name == "Tomcat":
|
||||
self.install_tomcat_async()
|
||||
return
|
||||
if tool_name == "MySQL":
|
||||
self.install_mysql_async()
|
||||
return
|
||||
try:
|
||||
command = build_install_command(tool_name)
|
||||
except ValueError as exc:
|
||||
messagebox.showwarning("暂不支持自动安装", str(exc))
|
||||
return
|
||||
mysql_note = ""
|
||||
if tool_name == "MySQL":
|
||||
mysql_note = (
|
||||
f"\n\n将安装 MySQL Community Server {MYSQL_VERSION},默认把 root 密码设置为 {MYSQL_ROOT_PASSWORD},"
|
||||
"并永久允许 6 位弱密码。MySQL 仅开放本机连接,不自动开放 Windows 防火墙端口。"
|
||||
)
|
||||
command_preview = " ".join(command).replace(
|
||||
f"root_passwd={MYSQL_ROOT_PASSWORD}", "root_passwd=******"
|
||||
)
|
||||
if not messagebox.askyesno(
|
||||
f"确认安装 {tool_name}",
|
||||
f"即将通过 winget 安装 {tool_name}。\n\n"
|
||||
f"命令: {command_preview}"
|
||||
f"{mysql_note}\n\n"
|
||||
f"命令: {' '.join(command)}\n\n"
|
||||
"安装可能需要管理员权限,并可能修改 PATH。是否继续?",
|
||||
):
|
||||
return
|
||||
self._append_log(f"开始安装 {tool_name}...")
|
||||
if tool_name == "MySQL":
|
||||
threading.Thread(target=self._install_mysql_worker, args=(command,), daemon=True).start()
|
||||
return
|
||||
threading.Thread(
|
||||
target=lambda: self.ui_queue.put(("install_done", (tool_name, run_install_command(command, self._thread_log)))),
|
||||
daemon=True,
|
||||
).start()
|
||||
|
||||
def _install_mysql_worker(self, command: list[str]) -> None:
|
||||
def install_mysql_async(self) -> None:
|
||||
if not messagebox.askyesno(
|
||||
"确认安装 MySQL",
|
||||
f"将从 MySQL 官方归档下载 MySQL Community Server {MYSQL_VERSION} 完整安装包(约 354 MB),"
|
||||
f"校验 SHA-256 后安装。\n\nroot 默认密码为 {MYSQL_ROOT_PASSWORD},并永久允许 6 位弱密码;"
|
||||
"仅开放本机连接,不自动开放 Windows 防火墙端口。\n\n安装时会请求管理员权限,是否继续?",
|
||||
):
|
||||
return
|
||||
self._append_log(f"开始安装 MySQL {MYSQL_VERSION}...")
|
||||
threading.Thread(target=self._install_mysql_worker, daemon=True).start()
|
||||
|
||||
def _install_mysql_worker(self) -> None:
|
||||
try:
|
||||
executable = install_mysql(command, self._thread_log)
|
||||
executable = install_mysql(self._thread_log)
|
||||
except Exception as exc:
|
||||
self.ui_queue.put(("mysql_install_done", (None, str(exc))))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user