如何在Windows服务之前启动MYSQL服务 [英] how to start the MYSQL service before my Windows service

查看:123
本文介绍了如何在Windows服务之前启动MYSQL服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have the windows service program which runs and sometime throw exception about system null reference. After my investigation, this is due to MySQL connection cannot establish due to MySql instance not up yet when startup computer. How to solve this problems???


在此先感谢


thanks in advance

推荐答案

您可以通过命令行调用该服务.在C#中使用Process.Start可以执行相同的操作.

启动/停止/启用/禁用mysql服务 [ ^ ]
You can call the service by command-line. Using Process.Start in C# you can execute the same thing.

Start / Stop / Enable / Disable mysql service[^]


如果您尝试配置服务,则会注意到依赖项"标签.
您始终可以将MySQL设置为依赖服务.它会在您的本地服务启动之前启动.

您也可以通过命令提示符-sc config< service1>进行配置. Depend =< service2>
If you try to configure your service, you will notice a ''dependencies'' tab.
You can always set MySQL to be a dependent service. It will start before your local service start.

You can also configure this via the command prompt - sc config <service1> depend= <service2>


2.3.5.7.将MySQL Server作为Microsoft Windows服务启动

在Windows上,建议的运行MySQL的方法是将其安装为Windows服务,这样,当Windows启动和停止时,MySQL会自动启动和停止,并且可以使用服务管理器框架进行管理.还可以使用NET命令或图形服务实用程序从命令行控制作为服务安装的MySQL服务器.通常,要将MySQL作为Windows服务安装,应使用具有管理员权限的帐户登录.

可以在Windows控制面板(在Windows 2000,XP,Vista和Server 2003上的管理工具"下)中找到服务"实用程序(Windows服务控制管理器).为避免冲突,建议在从命令行执行服务器安装或删除操作时关闭Services实用程序.

在将MySQL作为Windows服务安装之前,如果正在使用以下命令运行当前服务器,则应首先停止它:

C:\> "C:\ Program Files \ MySQL \ MySQL Server 5.1 \ bin \ mysqladmin"
-u root shutdown
2.3.5.7. Starting MySQL Server as a Microsoft Windows Service

On Windows, the recommended way to run MySQL is to install it as a Windows service, whereby MySQL starts and stops automatically when Windows starts and stops, and can be managed using the service manager framework. 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.

The Services utility (the Windows Service Control Manager) can be found in the Windows Control Panel (under Administrative Tools on Windows 2000, XP, Vista, and Server 2003). To avoid conflicts, it is advisable to close the Services utility while performing server installation or removal operations from the command line.

Before installing MySQL as a Windows service, you should first stop the current server if it is running by using the following command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
-u root shutdown


这篇关于如何在Windows服务之前启动MYSQL服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆