Windows Server 2003开机自动启动MySQL服务设置方法

时间:2021-11-24 04:36:03

Windows Server 2003开机自动启动MySQL服务设置方法

发布时间:2014-12-19 更新时间:2014-12-24 来源:网络

作者:eaglezhong

关键词: 2003 exe 开机 nbsp; 设置方法

&http://www.aliyun.com/zixun/aggregation/37954.html">nbsp;   每次开机我都要去点击mysqld-nt.exe执行文件才启动mysql,虽然将创建了mysqld-nt.exe快捷方式到桌面,但还是想它能自动启动,怎么可以象mssql那样设置开机跟着启动?

下面为笔者总结的一些经验与大家分享:

1.打开命令行窗口(CMD) 
2.切换到mysql目录下,例如:d:\xampp\mysql\bin 
3.输入mysqld-nt   --install,回车 
4.系统提示(Service   successfully   installed.)   //可省略 
5.打开[控制面板-管理工具-服务]     //可省略 
6.查看服务 "MySql "的启动类型为自动即可     //可省略

备注: 
1.步骤3,mysqld-nt   --install后可不加任何参数,默认配置。 
2.用命令行mysqld-nt   --remove,可删除任务 
3.不要使用计划任务,因为计划任务必须配置时间。

如果通过以上方面无法在服务中启动Mysql,请进行以下的设置:

照以上的方法mysqld-nt   --install安装成服务,看到启动类型为自动,右键点击它选启动,启动不了,出现1067错误,而且这时候发现连双击mysqld-nt.exe也启动不了, mysqld-nt   --remove删除服务,双击mysqld-nt.exe又能启动了,上网找1067错误,我的mysql装在d:\mysql,网上找到这个跟我的一样: 
================= 
you   seemed   have   your   mysql   installed   in   windows.   so   this   problem   may   becaused   if   you 're   not   installing   mysql   in   c:\mysql.

you   cansimply   copy   all   files   to   c:\mysql   or

create   a   file   call   my.ini(store   it   in   %windows%)   OR   my.cnf   (store   it   in   c:\)   and   the   followingcontent   should   be   in   the   file 
assume   you   have   mysql   ind:\mysql

[mysqld] 
#set   basedir   to   the   installationpath 
basedir=d:/mysql 
datadir=d:/mysql/data

note   that   theforward   slashes   (/)   are   being   used.   good   luck” 
================= 
跟据这个说的新建一个my.ini文件,加这些进去: 
[mysqld] 
#set   basedir   to   the   installationpath 
basedir=d:/mysql 
datadir=d:/mysql/data 
然后放在系统winnt目录里,再重新mysqld-nt   --install,然后就解决问题了。

笔者测试通过该方法即解决Windows Server 2003下Mysql自动启动的服务。