mysqladministrator 启动出错

来源:互联网 发布:python抓取微信公众号 编辑:程序博客网 时间:2024/06/06 05:58

<script type="text/javascript"><!-- google_ad_client = "pub-1992382271196226";/* 728x90, 创建于 08-3-9 */google_ad_slot = "1653402536";google_ad_width = 728;google_ad_height = 90;// --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><script type="text/javascript"><!-- google_ad_client = "pub-1992382271196226";/* 728x15, 创建于 08-9-3 */google_ad_slot = "9127232582";google_ad_width = 728;google_ad_height = 15;// --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>

 

Mysql community edition 5.1.37
Mysql administrator 1.2.17


Mysql是利用解压的方式安装在Windows操作系统上的。所以首先在C:/WINDOWS下面增加了my.ini(你可以在mysql安装目录下找到类似的my-small.ini, my-medium.ini等文件,随便拷贝一个修改名字为my.ini就好了,在my.ini [client]节下面的user、password表示当你用mysql程序如mysql.exe连接时采用的默认用户名和密码,通常会用mysql -u root -p之类的命令,如果在client节下设置了user和password值的话,直接用mysql命令就可以连接上数据库)。

利用"mysqld --install"命令可以将mysqld添加到Service当中去,这样可以通过服务进行启动。但是这样启动之后,你会发现启动mysqladministrator会出现如下错误提示(连接设置为host=localhost, port=3306, user=root, password是空,mysql默认的设置是这样的):


"Either the server service or the configuration file could not be found. Startup variables and service section are therefore disabled."


点击"OK" 发现Mysql administrator 好像工作正常,但是 "Service Control" 页面是灰的而且有一行红色的提示 "This section is only available when connected to localhost".

 

问题是mysqladministrator找不到my.ini,解决方法就是在mysqld启动的时候增加"--defaults-file"这个参数并指向my.ini.具体做法是:

首先停止msqld服务,然后利用mysqld --remove移除mysql服务,然后重新注册服务,命令行为mysqld --install MySQL --defaults-file=C:/Windows/my.ini

。其中MySQL表示服务的名字。

<script type="text/javascript"><!-- google_ad_client = "pub-1992382271196226";/* 728x90, 创建于 08-3-9 */google_ad_slot = "1653402536";google_ad_width = 728;google_ad_height = 90;// --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>