解决安装MySQL5.1出现Cannot create windows service for mysql.error:0

解决MySQL5.1安装配置问题
本文详细记录了解决MySQL5.1安装过程中出现的Cannot create windows service for mysql.error:0错误的方法,包括删除旧服务、清理相关文件等步骤。

今早上6点多就起来装MySQL5.1,我把以前MySQL5.0的GUI工具和服务器全部删掉,安装目录全部删掉,数据文件目录名字改掉,注册表用完美卸载清理了。

然后重启安装MySQL5.1(我以前遇到过服务启动不了的情况,这样做就搞定了),可配置到最后一步时出现Cannot create windows service for mysql.error:0错误,

把配置工具关掉重试几次都不行,后来百度了下,听说要在系统管理员用户下执行sc delete mysql删除MySQL服务后再启动配置工具配置,实在不行重启后再试。

我删掉服务再配置还是同样错误,再删掉服务,重启后配置还是不行。

又在网上参考了好些文章,最后解决办法如下:


1.出现错误后关掉配置工具,在系统管理员帐户下执行命令:sc delete mysql(mysql是服务名,根据你的服务名定);


2.删除C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/data目录下ib_logfile0ib_logfile1两个文件删除,顺便说句,此目录下有个err文件,是以主机名命名的,里面记载着错误信息,类似下面这段:

InnoDB: The first specified data file E:/Data/ibdata1 did not exist:
InnoDB: a new database to be created!
090501 19:20:08  InnoDB: Setting file E:/Data/ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Error: log file ./ib_logfile0 is of different size 0 48234496 bytes
InnoDB: than specified in the .cnf file 0 17825792 bytes!
090501 19:20:09 [ERROR] Plugin 'InnoDB' init function returned error.
090501 19:20:09 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
090501 19:20:09 [ERROR] Unknown/unsupported table type: INNODB
090501 19:20:09 [ERROR] Aborting
090501 19:20:09 [Warning] Forcing shutdown of 1 plugins
090501 19:20:09 [Note] E:/Program Files/MySQL/MySQL Server/bin/mysqld: Shutdown complete

3.删除配置时指定的数据文件目录,好像当时我的不能立即删除,我用unlocker删除时它说要下次重启时删除。

4.重启。

5.启动配置工具配置。

这次就成功了。

感谢提供帮助信息的前辈们,也希望对出现同样错误的朋友有帮助。

[2025-08-26 18:28:58] [SEVERE] [ejb-container] [FATAL ERROR: Unknown error in Assembler. com.tongweb.xbean.propertyeditor.PropertyEditorException: Unable to resolve class com.mysql.cj.jdbc.Driver at com.tongweb.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:43) at com.tongweb.xbean.propertyeditor.AbstractConverter.toObject(AbstractConverter.java:86) at com.tongweb.xbean.propertyeditor.PropertyEditors.getValue(PropertyEditors.java:284) at com.tongweb.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:172) at com.tongweb.xbean.recipe.ObjectRecipe.extractConstructorArgs(ObjectRecipe.java:596) at com.tongweb.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:276) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:49) at com.tongweb.tongejb.assembler.classic.ThorAssembler.createResource(ThorAssembler.java:997) at com.tongweb.tongejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:430) at com.tongweb.tongejb.assembler.classic.Assembler.build(Assembler.java:345) at com.tongweb.tongejb.OpenEJB$Instance.<init>(OpenEJB.java:144) at com.tongweb.tongejb.OpenEJB.init(OpenEJB.java:290) at com.tongweb.twnt.thor.ThorTomcatLoader.initializeModified(ThorTomcatLoader.java:182) at com.tongweb.twnt.thor.ThorTomcatLoader.initialize(ThorTomcatLoader.java:71) at com.tongweb.twnt.thor.TomcatLoader.init(TomcatLoader.java:131) at com.tongweb.twnt.thor.ThorServerListener.lifecycleEvent(ThorServerListener.java:99) at com.tongweb.web.thor.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at com.tongweb.web.thor.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at com.tongweb.web.thor.util.LifecycleBase.setStateInternal(LifecycleBase.java:401) at com.tongweb.web.thor.util.LifecycleBase.init(LifecycleBase.java:110) at com.tongweb.web.thor.util.LifecycleBase.start(LifecycleBase.java:139) at com.tongweb.web.thor.startup.Tomee.start(Tomee.java:681) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.tongweb.web.thor.startup.ThorBootstrap.start(ThorBootstrap.java:412) at com.tongweb.web.thor.startup.ThorBootstrap.main(ThorBootstrap.java:558) Caused by: java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:278) at com.tongweb.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:40) ... 29 more ] [2025-08-26 18:28:58] [SEVERE] [ejb-container] [EJB container has encountered a fatal error and cannot be started: Assembler failed to build the container system.] com.tongweb.tongejb.OpenEJBException: com.tongweb.xbean.propertyeditor.PropertyEditorException: Unable to resolve class com.mysql.cj.jdbc.Driver: Unable to resolve class com.mysql.cj.jdbc.Driver at com.tongweb.tongejb.assembler.classic.Assembler.build(Assembler.java:358) at com.tongweb.tongejb.OpenEJB$Instance.<init>(OpenEJB.java:144) at com.tongweb.tongejb.OpenEJB.init(OpenEJB.java:290) at com.tongweb.twnt.thor.ThorTomcatLoader.initializeModified(ThorTomcatLoader.java:182) at com.tongweb.twnt.thor.ThorTomcatLoader.initialize(ThorTomcatLoader.java:71) at com.tongweb.twnt.thor.TomcatLoader.init(TomcatLoader.java:131) at com.tongweb.twnt.thor.ThorServerListener.lifecycleEvent(ThorServerListener.java:99) at com.tongweb.web.thor.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at com.tongweb.web.thor.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at com.tongweb.web.thor.util.LifecycleBase.setStateInternal(LifecycleBase.java:401) at com.tongweb.web.thor.util.LifecycleBase.init(LifecycleBase.java:110) at com.tongweb.web.thor.util.LifecycleBase.start(LifecycleBase.java:139) at com.tongweb.web.thor.startup.Tomee.start(Tomee.java:681) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.tongweb.web.thor.startup.ThorBootstrap.start(ThorBootstrap.java:412) at com.tongweb.web.thor.startup.ThorBootstrap.main(ThorBootstrap.java:558) Caused by: com.tongweb.xbean.propertyeditor.PropertyEditorException: Unable to resolve class com.mysql.cj.jdbc.Driver at com.tongweb.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:43) at com.tongweb.xbean.propertyeditor.AbstractConverter.toObject(AbstractConverter.java:86) at com.tongweb.xbean.propertyeditor.PropertyEditors.getValue(PropertyEditors.java:284) at com.tongweb.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:172) at com.tongweb.xbean.recipe.ObjectRecipe.extractConstructorArgs(ObjectRecipe.java:596) at com.tongweb.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:276) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:49) at com.tongweb.tongejb.assembler.classic.ThorAssembler.createResource(ThorAssembler.java:997) at com.tongweb.tongejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:430) at com.tongweb.tongejb.assembler.classic.Assembler.build(Assembler.java:345) ... 18 more Caused by: java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:278) at com.tongweb.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:40) ... 29 more [2025-08-26 18:28:58] [SEVERE] [other] [TongWeb Listener can't start EJB container] com.tongweb.tongejb.OpenEJBException: com.tongweb.xbean.propertyeditor.PropertyEditorException: Unable to resolve class com.mysql.cj.jdbc.Driver: Unable to resolve class com.mysql.cj.jdbc.Driver at com.tongweb.tongejb.assembler.classic.Assembler.build(Assembler.java:358) at com.tongweb.tongejb.OpenEJB$Instance.<init>(OpenEJB.java:144) at com.tongweb.tongejb.OpenEJB.init(OpenEJB.java:290) at com.tongweb.twnt.thor.ThorTomcatLoader.initializeModified(ThorTomcatLoader.java:182) at com.tongweb.twnt.thor.ThorTomcatLoader.initialize(ThorTomcatLoader.java:71) at com.tongweb.twnt.thor.TomcatLoader.init(TomcatLoader.java:131) at com.tongweb.twnt.thor.ThorServerListener.lifecycleEvent(ThorServerListener.java:99) at com.tongweb.web.thor.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at com.tongweb.web.thor.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at com.tongweb.web.thor.util.LifecycleBase.setStateInternal(LifecycleBase.java:401) at com.tongweb.web.thor.util.LifecycleBase.init(LifecycleBase.java:110) at com.tongweb.web.thor.util.LifecycleBase.start(LifecycleBase.java:139) at com.tongweb.web.thor.startup.Tomee.start(Tomee.java:681) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.tongweb.web.thor.startup.ThorBootstrap.start(ThorBootstrap.java:412) at com.tongweb.web.thor.startup.ThorBootstrap.main(ThorBootstrap.java:558) Caused by: com.tongweb.xbean.propertyeditor.PropertyEditorException: Unable to resolve class com.mysql.cj.jdbc.Driver at com.tongweb.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:43) at com.tongweb.xbean.propertyeditor.AbstractConverter.toObject(AbstractConverter.java:86) at com.tongweb.xbean.propertyeditor.PropertyEditors.getValue(PropertyEditors.java:284) at com.tongweb.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:172) at com.tongweb.xbean.recipe.ObjectRecipe.extractConstructorArgs(ObjectRecipe.java:596) at com.tongweb.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:276) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61) at com.tongweb.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:49) at com.tongweb.tongejb.assembler.classic.ThorAssembler.createResource(ThorAssembler.java:997) at com.tongweb.tongejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:430) at com.tongweb.tongejb.assembler.classic.Assembler.build(Assembler.java:345) ... 18 more Caused by: java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:278) at com.tongweb.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:40) ... 29 more
最新发布
08-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值