My (SQL) WorkLog: Cannot create Windows service for MySQL.Error:0

Friday, January 22, 2010

Cannot create Windows service for MySQL.Error:0

Platform: Windows


People often checks MySQL's download section and when they notice that there is new version of MySQL released they just can't wait for a second & starts downloading it so that they can install it on their windows box for testing purpose. Ok fine, download is completed its time to install it. Couple of successful "NEXT" and In the last step they
encounter a error message such as
"Cannot create Windows service for MySQL.Error:0"

We are so intelligent ppl that we don't want to take any help from our colleague..
And what we do is we just delete the directory in which new installation has been done & starts the installation
wizard one-more time in the hope that this time we gonna install it.

Again the result is same "Cannot create Windows service for MySQL.Error:0"

So why are we getting error that too at the last step? one common thought is "there must be something wrong
or some sort of bug in the new release"

How to resolve this error?
The primary reason for this error is that you haven't properly uninstalled the 
previously installed MySQL server & in the installation wizard  last step was
 to create  the service with the name "MySQL" and which has the same name as that 
 of the existing service (default is "MySQL").

Solution for this error is to first stop the service if it is running and then remove 
the service.

C:\>NET STOP MYSQL
The MySQL
service is stopping.
The MySQL service was stopped successfully.

Once the service is stopped, it can be removed with the SC utility:
C:\>SC DELETE MYSQL

[SC]
DeleteService SUCCESS

With the previous service stopped and removed, you can now run the MySQL Configuration Wizard again to configure and start the new MySQL service.




38 comments:

reks said...

Actually i tried this solution, but i am getting access denied in command prompt if i type the sc delete command. what can be done?

Umesh Shastry said...

Did you stop the service before deleting? also I think you need to have administrative rights in order to add/delete services.

Anonymous said...

I completed your steps and then ran the config wizard and I still get the same error...help

Cor said...

i tried this and successfully removed the service, but i ran into the same problem the 2nd X around.

Umesh Shastry said...

Could you send me the screen shot of error? also did you check whether or not you have opened the 3306 port?

for opening port follow the steps from below link

http://ushastry.blogspot.com/2009/06/installing-mysql-on-windows.html

Dragec said...

Thnx, It worked well for me !

Sam said...

This doesn't work for me, after reinstalling the services refuse to start, none of common fixes work like removing the service from the registry

Umesh Shastry said...

Sam,

I appreciate if you could post the exact error you are getting.

Sam said...

In the config wizard I'm doing:

Detailed Cofiguration
Developer Machine
Multifunctional Database
C:\installation path
Decision Support (DSS)/OLAP
Enable TCP/IP Networking port (Yes) Port 3306
Enable Strict mode (Yes)
Standard Char set
Install as Windows Services (with custom name never used before)
launch automatically (Yes)
Set root password
Execute

"Start Service" step fails, with message "Could not start the service MySQL1"

If I go back, then Next again, and execute again, I get the error message:

"Cannot create the windows service for MySQL1. Error:0"

Anonymous said...

I think my problem is the name of the service, is there a way to delete an instance so I can change it?

Sam said...

I posted the error, has it not come through?

Umesh Shastry said...

First remove the service

E:\MySQL5.1.30\bin>mysqld.exe --remove MySQL1

You shud get a message stating as
Service successfully removed.

E:\MySQL5.1.30\bin>

Now try to create the service from command line (pls change the path as er your environment)


E:\>cd MySQL5.1.30/bin

E:\MySQL5.1.30\bin>mysqld.exe --install mysql4sam
Service successfully installed.

E:\MySQL5.1.30\bin>net start mysql4sam
The mysql4sam service is starting.
The mysql4sam service was started successfully.


E:\MySQL5.1.30\bin>

sirtordo said...

It worked well for me.

akiles said...

ushastry is a great man.He helped me lot on my starting to understand sql.Thank u sir.Hope u remember me.

-akiles

pulahan said...

thanks man.
i have the same problem and now it works.

paul said...

thankyouthankyou

pooja said...

hi umesh can i have ure mobile no ..as i got this link from monster u were looking for job or nt.if u can call me on my mobile 9885111752

Anonymous said...

Got your profile through one of the job portals; somehow managed to get through your email ID and dropped you an email regarding a hot requirement which we are sharing with one of our clients.

Pls revert if you are willing for a job change; would really appreciate if you could revert on the mails sent till date...

deepti@v3ti.com

Anonymous said...

Hi Umesh,

I'm re-installing MySQL server on Windows Server 2008, however it's asking me for the current Root password and the new password to be set. I do not know the current Root password, as I've uninstalled MySQL server in the past. That's why the MySQL service fails to start as well.

Can you please advise?
Many thanks in advance!

Umesh Shastry said...

Please bring down MySQL service before re-installing(and remove the same afterwords) and make sure you move the datadir somewhere else before starting the new installation.

Please let me know if you face any issues.

Thanks,
Umesh

Anonymous said...

Thanks, Umesh. That worked.

I have another issue:

I have 2 servers, both are running Windows Server 2008 and are identical in configurations. I installed MySQL 5.1 server, MySQL Workbench, and MySQL Connector on both of these machines. However, when I open up MySQL Workbench on one machine, I can query the database and see the tables/data, but not on the other machine when I do a query. Why is that? What is the proper way to add exiting databases in Workbench? Should I start with "New Server Instance" or "New Connection"?

Is it because I have the database folders in the wrong location? Where should the MySQL databases located? I put mine in c:\program files\MySQL\MySQL Server 5.1\data. Is this the proper place?

Umesh Shastry said...

I have very less knowledge of Workbench.. will give a try today and would let you know how to connect local/remote servers using the GUI tool.

Anonymous said...

Thank you, Umesh.

Umesh Shastry said...

By using the "New Connection" option you can open "Set up New Connection" Wizard and make sure you provide required info (hostname or ip of MySQL server that you want to connect; and a valid user credentials who can connect from remote)..

Anonymous said...

when I try the command prompt method..I get an error "Install/Remove of the service denied!"

Umesh Shastry said...

Are you in Admin group? pls let me know

city50 said...

I am using windows 7 and i installed mysql successfully, but i needed to reinstall it and when i reinstalled i got not responding on 'Start Service'. i think i dont know how to uninstall it completely. pls help

Umesh Shastry said...

Please remove the service "MySQL" or "mysql" manually then try to reinstall. Let me know how it goes.

city50 said...

somehow i did it :)

Anonymous said...

i am facing problem to start the mysql service while reinstalling on windows 7.
i tried all the above methods but no success.

kalyani said...

hi i am also facing the same problem when reinstalling mysql on windows 7 .I tried with different options please let me known how to do it frnds.

Umesh Shastry said...

Don't have Windows 7 at home, will install on my office box and would get you the steps(seems problems starts on last step where installer try to create service and hungs when there is already a service "MySQL|mysql" exists.. or older installation's MySQL data dir exists )

Anonymous said...

Solution! It works for me. Easy steps.

http://www.vertstudios.com/blog/mysql-error0-cannot-create-windows-service/

Anonymous said...

If you are unable to delete 'mysql' services: Instead of the default 'mysql' service select another from dropdown during the configuration.

Anonymous said...

Hi, i have installed MySQL and it was working. suddenly one day when i tried to open the Query browser it gave some error msg and told to ping, i tried but didn't work. So i uninstalled and tried to reinstall but the service is not getting start.
I tried removing all MySQL data in program files and in applocation data, still its not working. please help me . I'm using windows 7 ultimate.

Rony said...

Thanks a bunch for sharing this with all folks you actually know what you are talking about! Bookmarked. Please additionally seek advice from my website =). We could have a hyperlink trade arrangement among us.
Create a MySQL database.

Kid said...

tks U so much

Nilnilu Zen said...

Hello sir I use MySQL5.5 .

Detailed Configuration.
Devloper Machine.
Multifunctional Database.
Installation Path.
Decission Support(DSS)/OLP.
Enable TCP/IP Networking,Enable Strict Mode.
Standard CharaecterSet.
Install as Windows Service(yes).
Modify security Setting(no).
Create An Anonymus AC(no).
Execute.
i found the same error
Cannot create windows SErvice for MySQL

Post a Comment