C:\Windows\system32>e:
E:\mysql-5.7.19\bin>mysqld --install
The service already exists!
The current server installed: E:\mysql-5.7.19\bin\mysqld MySQL
E:\mysql-5.7.19\bin>net start MySQL80
服务名无效。
请键入 NET HELPMSG 2185 以获得更多的帮助。
E:\mysql-5.7.19\bin>net start MySQL
MySQL 服务正在启动 .
MySQL 服务无法启动。
服务没有报告任何错误。
请键入 NET HELPMSG 3534 以获得更多的帮助。
E:\mysql-5.7.19\bin>net stop mysql
没有启动 MySQL 服务。
请键入 NET HELPMSG 3521 以获得更多的帮助
E:\mysql-5.7.19\bin>mysqld --initialize-insecure
2021-03-18T06:00:36.623218Z 0 [ERROR] Can't find error-message file 'E:\mysql-5.7.19\bin\:\mysql-5.7.19\share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2021-03-18T06:00:36.625219Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2021-03-18T06:00:36.626219Z 0 [ERROR] Aborting
以管理员的身份打开cmd
E:\mysql-5.7.19\bin>sc delete mysql
[SC] DeleteService 成功
E:\mysql-5.7.19\bin>mysqld -install mysql
Service successfully installed.
E:\mysql-5.7.19\bin>net start mysql
mysql 服务正在启动 .
mysql 服务无法启动。
服务没有报告任何错误。
请键入 NET HELPMSG 3534 以获得更多的帮助。
E:\mysql-5.7.19\bin>
执行mysqld --initialize-insecure ,执行报错,查看bin的同级目录下会多出一个data文件夹,里面一堆文件,删掉,再执行。
E:\mysql-5.7.19\bin>mysqld -install
The service already exists!
The current server installed: E:\mysql-5.7.19\bin\mysqld MySQL
E:\mysql-5.7.19\bin>sc query mysql
SERVICE_NAME: mysql
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
E:\mysql-5.7.19\bin>mysqld -install
The service already exists!
The current server installed: E:\mysql-5.7.19\bin\mysqld MySQL
E:\mysql-5.7.19\bin>mysqld --initialize-insecure --user=mysql
2021-03-18T07:56:39.779379Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-03-18T07:56:39.782380Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2021-03-18T07:56:39.782380Z 0 [ERROR] Aborting
E:\mysql-5.7.19\bin>sc query mysql
SERVICE_NAME: mysql
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
E:\mysql-5.7.19\bin>sc delete mysql
[SC] DeleteService 成功
E:\mysql-5.7.19\bin>mysqld -install
Service successfully installed.
E:\mysql-5.7.19\bin>mysqld --initialize-insecure --user=mysql
2021-03-18T07:57:44.499480Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-03-18T07:57:44.502481Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2021-03-18T07:57:44.503479Z 0 [ERROR] Aborting
E:\mysql-5.7.19\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务无法启动。
服务没有报告任何错误。
请键入 NET HELPMSG 3534 以获得更多的帮助。
E:\mysql-5.7.19\bin>mysqld --install
The service already exists!
The current server installed: E:\mysql-5.7.19\bin\mysqld MySQL
E:\mysql-5.7.19\bin>sc delete mysql
[SC] DeleteService 成功
E:\mysql-5.7.19\bin>sc query mysql
[SC] EnumQueryServicesStatus:OpenService 失败 1060:
指定的服务未安装。
E:\mysql-5.7.19\bin>mysqld -install
Service successfully installed.
E:\mysql-5.7.19\bin>sc query mysql
SERVICE_NAME: mysql
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
E:\mysql-5.7.19\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务无法启动。
服务没有报告任何错误。
请键入 NET HELPMSG 3534 以获得更多的帮助。
E:\mysql-5.7.19\bin>sc delete mysql
[SC] DeleteService 成功
E:\mysql-5.7.19\bin>mysqld --install
Service successfully installed.
E:\mysql-5.7.19\bin>sc query mysql
SERVICE_NAME: mysql
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
E:\mysql-5.7.19\bin>mysqld --initialize
E:\mysql-5.7.19\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。