> 技术文档 > Mysql 在安装时遇到“Install/Remove of the Service Denied!”错误时处理办法_install of the service denied

Mysql 在安装时遇到“Install/Remove of the Service Denied!”错误时处理办法_install of the service denied

遇到“Install/Remove of the Service Denied!”错误时,通常由权限不足或旧服务残留导致,可按以下步骤解决:

  1. 以管理员身份运行命令提示符
    右键点击 cmd.exeWindows PowerShell,选择“以管理员身份运行”。这是解决权限问题的关键步骤。

  2. 检查并删除残留的旧服务
    若曾安装过MySQL但未彻底卸载,旧服务可能占用端口或名称。执行以下命令:

    sc query mysql # 查询是否存在旧服务 sc delete mysql # 删除旧服务(若存在) 

    此操作同样需管理员权限。

  3. 重新安装MySQL服务
    进入MySQL的 bin 目录后,执行:

    mysqld --install # 安装服务(需管理员权限) 

    成功后会显示 Service successfully installed.

其他注意事项

  • 确保MySQL安装路径不含中文或特殊字符,避免初始化数据库时出错。
  • 若仍失败,可尝试修复系统文件:sfc /scannow