app网站及其特色,网站建设开发电销话术,购物网站开发多少钱,广州建设局文章目录 问题描述排查1.字面意思2.搜索引擎3.官方文档4.源码 处理方法相关扩展 问题描述
MySQL安装MySQL服务时提示Install-Remove of the Service Denied!
详细报错如下#xff1a;
C:\Users\荷塘月色net start mysql
服务名无效。请键入 NET HELPMSG 2185 以获得更多… 文章目录 问题描述排查1.字面意思2.搜索引擎3.官方文档4.源码 处理方法相关扩展 问题描述
MySQL安装MySQL服务时提示Install-Remove of the Service Denied!
详细报错如下
C:\Users\荷塘月色net start mysql
服务名无效。请键入 NET HELPMSG 2185 以获得更多的帮助。C:\Users\荷塘月色cd /d F:\Database\mysql-5.7.25-winx64\binF:\Database\mysql-5.7.25-winx64\binmysqld -install
Install/Remove of the Service Denied!F:\Database\mysql-5.7.25-winx64\bin排查
1.字面意思
Install/Remove of the Service Denied
安装/删除服务被拒绝看起来好像是权限问题权限不够。
2.搜索引擎
MySQL的文章还是很多的这个问题好像也挺常见的很容易就搜到了。
确实是权限不够用管理员权限打开cmd就可以了。
3.官方文档
虽然已经有了处理方法还是想看看官方文档有没有相关的说明。
相关搜索https://dev.mysql.com/doc/search/?d12p1qmysqld-install
找了篇文章https://dev.mysql.com/doc/refman/5.7/en/windows-start-service.html
复制了下前面的一段话注意后面加粗部分即是相关说明。 On Windows, the recommended way to run MySQL is to install it as a Windows service, so that MySQL starts and stops automatically when Windows starts and stops. A MySQL server installed as a service can also be controlled from the command line using NET commands, or with the graphical Services utility. Generally, to install MySQL as a Windows service you should be logged in using an account that has administrator rights. 在Windows上推荐的运行MySQL的方式是将其作为Windows服务安装以便MySQL在Windows启动和停止时自动启动和停止。安装为服务的MySQL服务器也可以使用。NET命令或图形化服务实用程序从命令行进行控制。一般来说要将MySQL安装为Windows服务您应该使用具有管理员权限的帐户登录。 4.源码
搜关键字Remove of the Service找到了相关源码mysql-server\router\src\router\src\windows\nt_servc.cc
主要代码 if (ret_error ERROR_ACCESS_DENIED) {printf(Install/Remove of the Service Denied!\n);if (!is_super_user())printf(That operation should be made by a user with Administrator privileges!\n);} elseprintf(There is a problem when opening the Service Control Manager!\n);处理方法
用管理员权限打开cmd执行命令注册服务。
C:\Windows\system32cd /d F:\Database\mysql-5.7.25-winx64\binF:\Database\mysql-5.7.25-winx64\binmysqld --install MySQL57 --defaults-fileF:\Database\mysql-5.7.25-winx64\my.ini
Service successfully installed.F:\Database\mysql-5.7.25-winx64\binmysqld --initializeF:\Database\mysql-5.7.25-winx64\binmysqld --initialize
2025-02-14T03:47:12.878700Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2025-02-14T03:47:12.881124Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2025-02-14T03:47:12.882042Z 0 [ERROR] AbortingF:\Database\mysql-5.7.25-winx64\binnet start mysql57
MySQL57 服务正在启动 .
MySQL57 服务已经启动成功。F:\Database\mysql-5.7.25-winx64\bin相关扩展 mysqld --install 注册服务时可指定服务名称比如一个Windows上面安装两个版本的MySQL数据库具体可参考https://dev.mysql.com/doc/refman/5.7/en/windows-start-service.html。 mysqld --initialize 初始化数据库的目录必须为空。但是如果不为空会有提示不会强制删除文件。如上示例 net start 启动服务命令服务名不区分大小写。