Install MySQL , the system prompts: Can not create windows service for mysql.error : 0
The reason is that the system has the old mysql service exists, the solution is as follows:
To permanently remove the old mysql service, you need to manage user permissions to perform the following command on the command line:
C: /> sc the Delete mysql
[SC] DeleteService SUCCESS
When installing the service, if a similar situation occurs, look in the service is not a legacy of service program, the solution, remove the old service, the installation of new services.
! / * cteate Table A Test; * /
the DROP TABLE `baninfo_special` the IF EXISTS;
the CREATE TABLE baninfo_special`` (
`ID` int (. 11) the NOT NULL AUTO_INCREMENT,
` special_ID` int (. 11) the NOT NULL,
`port` int ( . 11),
`time` timestamp,
` src_IP` VARCHAR (64) default '',
`act` int (. 11),
` baninfo_specialname` VARCHAR (64) default '',
`password` VARCHAR (64) default '',
a PRIMARY KEY ( `ID`)
) ENGINE = MyISAM the DEFAULT the CHARSET = 'UTF8';
Attached, operating on services:
[service name], such as deleting messager service, enter SC DELETE MESSAGER.
SC using the syntax:
1. SC [Servername] Command Servicename [the Optionname = Optionvalue]
2. SC [Command]
As used herein, a first syntax SC, using the second syntax help display.
The following describes the various parameters.
Servername
Alternatively: double slash can be used, such as // myserver , may be //192.168.0.1 to operate the remote computer. If the operation on the local computer
do not need to add any parameters.
Command
following command SC can be used are listed.
config ---- change the configuration of a service. (Long-term)
continue-- to send a service requires a continued control.
control ---- sends a control to a service.
create ---- Creates a service. (Added to the registry)
the Delete ---- Delete a service. (Deleted from the registry)
EnumDepend-- listed affiliation services.
GetDisplayName-- get the display name of a service.
GetKeyName-- obtain a service key name services.
interrogate-- send an inquiry to a service control requirements.
pause ---- a service for sending a pause control requirements.
qc ---- ask a configuration service.
query ---- ask a service of the state, the state also cited the type of service.
start ---- start a service.
stop ---- sent a stop request for a service.
Servicename
the name of the service key in the registry developed. Note that this name is different from the display name (the name and service can be controlled with the net start
to see Panel), and SC using services and services to identify key name.
Optionname
this optionname and optionvalue parameter allows you to specify the operation command parameter name and value. Note that this is important in the operation name and so on
are no spaces between the numbers. At first I did not know the results .................., for example, start = optionvalue, this is very important.
optionvalue may be 0,1, or more operating parameter name and value pairs.
If you want to see optionvalue can use each of the commands, you can use the format of such sc command. This will provide detailed help for you.
Optionvalue
Specify its value is the name of the parameter optionname. The valid range is often limited to a parameter which optionname. If you want to make a list with
sc command to ask each command.
Comments
Many commands require administrator privileges, so I want to say, when you operate these things is the best administrator. Ha ha!
When you type SC without any parameters, SC.exe command displays help information and available. When you type the command name followed by SC, you can get
a detailed list of the commands. For example, type sc create can be relevant and create a list.
But in addition to a command, sc query, which exports the current state of the system in all services and drivers that are running.
When you use the start command, you can pass some parameters (arguments) to the service of the main function, but the main function is not to the service process.
SC create
this command can create an entry in the registry and the Service Control Manager database.
Syntax 1
sc [ServerName] the Create Servicename [Optionname = Optionvalue]
ServerName here, servicename, optionname, optionvalue and the same as above, there is not much to say. Here we detail
out what optionname and optionvalue.
Optionname - Optionvalue
Description
type ---- own, share, interact, kernel, filesys =
type on the establishment of the service, including the type of option value drivers use, the default is to share.
start = ---- boot, system, auto , demand, disabled
type, option values on to start the service include the type of driver uses the default is demand (manual).
error = ---- normal, severe, critical , ignore
while serving in the severity import failure errors, default is normal.
binPath = - (string)
Path name to the service binary file, there is no default, the string must be set.
group = ---- (string)
This service belongs to the group, the group list is stored in the registry ServiceGroupOrder. The default is nothing.
tag = ---- (string)
If this string is set to yes, sc may be obtained from a tagId in CreateService call. However, SC does not display the label, the
use of this little sense. The default is Nothing
the depend = ---- (Space Separated String) has a string of spaces.
You must start before this service starts or the name of the service group.
obj = ---- (string)
name of the account used to run, it can be said that the identity of the landing. The default is LocalSystem
Displayname = - (String)
a string used to identify each service in the user interface program.
password = - (string)
a password, if the need to use a different than the account used localsystem.
Optionvalue
list of values Optionname parameter names. Reference optionname. When we enter a string, if you enter a null reference which means that
an empty string will be imported.
Comments
of The SC Performs The Operations of the CREATE Command The CreateService API
function.
Performs this operation CreateService API function sc create command. See detailed CreateService.
Example 1
The following example is called (in a // myserver on the computer) is called "NewService" the establishment of a registry of service registration.
sc // myservercreate NewService binpath = c: /winnt/system32/NewServ.exe
By default, this service creates a WIN32_SHARE_PROCESS use SERVICE_DEMAND_START starts. This will not have any subordinate
relations, will also be run in accordance with the security localsystem down relationship.
Two cases
following example will be on the local computer, set up a service that will automatically run a service, and runs his own process. It
belongs to the TDI group and NetBios services. Note that you must add a reference to a space in the middle of the slave.
Create NewService binpath C = SC: type = /winnt/system32/NewServ.exe own
Start = Auto the depend = "+ the Netbios the TDI"
Example 3
service developer may be the service run by temporarily changing the binary path (video path) manner in the vertical relationship between the kernel debugger. Under
the surface of this example let us see how you can change the service configuration.
sc config NewService binpath = "ntsd -dc : /winnt/system32/Newserv.exe"
This example will cause the call service control manager ntsd.exe parameter string using the following example:
"-dc: / NT / system32 / NewServ. exe "
When the system is loaded newserv.exe ntsd will turn to break the debugger, so breakpoints can be set in the service code.
SC QC
The SC QC "asked Configuration" command to list the configuration information for a service and QUERY_SERVICE_CONFIG structure.
Syntax 1
sc [Servername] qc Servicename [Buffersize]
the Parameters
ServerName previous servicename has been introduced, it will not say any more.
Buffersize, Alternatively, the size of the buffer listed.
Comments
SC command shows the contents of the QC QUERY_SERVICE_CONFIG structure.
The following is the corresponding QUERY_SERVICE_CONFIG region.
------ dwServiceType the TYPE
start_type ---- dwStartType
ERROR_CONTROL ---- dwErrorControl
BINARY_PATH_NAME - lpBinaryPathName
LOAD_ORDER_GROUP - lpLoadOrderGroup
TAG ------ dwTagId
DISPLAY_NAME ---- lpDisplayName
---- lpDependencies DEPENDENCIES
SERVICE_START_NAME - lpServiceStartName
Example 1
The following example asked Configuration "NewService" service established in the above example:
sc // myserver qc NewService
sc display the following information:
SERVICE_NAME: NewService
the TYPE: 20 WIN32_SHARE_PROCESS
start_type : 3 DEMAND_START
ERROR_CONTROL: 1 the NORMAL
BINARY_PATH_NAME: c: /winnt/system32/NewServ.exe
LOAD_ORDER_GROUP:
TAG: 0
DISPLAY_NAME: NewService
DEPENDENCIES:
SERVICE_START_NAME: the LocalSystem
NewService other services and have the ability to share a single process. But it is not automatically activated. Binary file name is NewServ.exe. This service
And not rely on other services, and run up and down the relationship between the Security lcoalsystem. These are the basic call QueryServiceStatus return
back, if need more details then, you can take a look at the file API function.
The QUERY SC
SC the QUERY command information available services.
Syntax:
SC [Servername] Query Servicename {|} ... the Optionname = Optionvalue
parameters:
ServerName, SERVICENAME, Optionname, OptionValue not explained. Talk about what the value of this command provides.
Optionname - Optionvalue
the Description
of the type = ---- Driver, Service, All
enumerated type of service, the default is Service
State = ---- the Active, inactive, All
listed status of the service, the default is the Active
bufsize = - (numeric value )
include the buffer size, default bytes 1024
RI = ---- (numeric value)
but include start, the recovery of the digital pointer, the default is 0
Optionvalue
above.
Comments
SC can display the contents of the QUERY command SERVICE_STATUS structure.
Here is the corresponding structure information SERVICE_STATUS:
the TYPE ------ dwServiceType
the STATE ------ dwCurrentState, dwControlsAccepted
WIN32_EXIT_CODE ---- dwWin32ExitCode
SERVICE_EXIT_CODE - dwServiceSpecificExitCode
the CHECKPOINT ---- dwCheckPoint
WAIT_HINT ---- dwWaitHint
start after the computer, use the SC
the QUERY command will tell you whether or not an attempt to start the service. If the service starts successfully, WIN32_EXIT_CODE will range will include a 0, when the attempt is unsuccessful, when it realized that the service can not be started, this section will also provide an exit code to the service.
例子
查询“NewService"服务状态,键入:
sc query NewService
显示一下信息:
SERVICE_NAME: NewService
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 1 STOPPED
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
注意,这里存在一个给这个服务的退出码,即使这个服务部不在运行,键入net helpmsg 1077,将会得到对1077错误信息的说明:
上次启动之后,仍未尝试引导服务。
所以,这里我想说一句,希望大家可以活用net helpmsg,这会对你的学习有很大的帮助。
下面在对SC query的命令在说明一下:
列举活动服务和驱动程序状态,使用以下命令:
sc query
显示messenger服务,使用以下命令:
sc query messenger
只列举活动的驱动程序,使用以下命令:
sc query type= driver
列举Win32服务,使用以下命令:
sc query type= service
列举所有的服务和驱动程序,使用以下命令:
sc query state= all
用50 byte的缓冲区来进行列举,使用以下命令:
sc query bufsize= 50
在恢复列举时使用index=14,使用以下命令:
sc query ri=14
列举所有的交互式服务,使用以下命令:
sc query type= service type= interact
=====================================
命令行使用sc命令.
关于sc命令的详解,请自行查看帮助(sc /?),在此只简单提及如何加入系统服务功能.
加入服务:
sc create ServiceName binPath= 路径 start= auto
(等号后面的空格必须)
删除服务:
sc delete ServiceName
e.g
将Tomcat加入到系统服务中:
sc create Tomcat binPath= F:/apache-tomcat/bin/startup.bat start= auto
将Tomcat服务删除:
sc delete Tomcat
sc description tomcat "提供 TCP/IP 网络上客户端和服务器之间端对端的安全。如果此服务被停用,网络上客户端和服务器
转载于:https://www.cnblogs.com/JoannaQ/archive/2012/08/17/2644586.html