Bug #20758 cannot start server. Error 2: cannot find file
Submitted: 28 Jun 2006 18:07 Modified: 29 Jun 2006 19:08
Reporter: Dennis Foreman Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:4.1 OS:Windows (XP Pro)
Assigned to: MySQL Verification Team CPU Architecture:Any

[28 Jun 2006 18:07] Dennis Foreman
Mysql gets error message: "cannot start service. error code 2: system cannot find file." The error log is totally empty for the day in question. The my.ini file is in the folder indicated in the Service Startup panel. There is no clue as to what file the system cannot find.

How to repeat:
This bug just started today. I can repeat it every time I start the Mysql service on this machine.
[28 Jun 2006 18:23] MySQL Verification Team
Thank you for the bug report. Could you please try to get the
error message issuing within a DOS prompt in the \bin install

mysqld-nt --defaults-file"path_to_your_my.ini" --standalone --console

the above is assuming mysqld-nt.exe is the binary which belongs to the
service image path, you can see which binary is issuing:

C:\>sc qc mysql
[SC] GetServiceConfig SUCCESS

        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 3   DEMAND_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : c:\mysql\bin\mysqld-nt MySQL
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : MySQL
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem
[28 Jun 2006 20:00] Dennis Foreman
Here's a paste of my console activity. No error message occured.
C:\Program Files\MySQL\MySQL Server 4.1\bin>mysqld-nt --defaults-file="..\" --st
andalone --console

C:\Program Files\MySQL\MySQL Server 4.1\bin>sc qc mysql
[SC] GetServiceConfig SUCCESS

        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 2   AUTO_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : "C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqld
-max-nt" --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini" "MySQL
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : MySQL
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem
[28 Jun 2006 20:03] Dennis Foreman
I ran the command again, this time explicitly stating the my.ini file and got this:
C:\Program Files\MySQL\MySQL Server 4.1\bin>mysqld-nt --defaults-file="..\my.ini
" --standalone --console
060628 16:01:17  InnoDB: Started; log sequence number 0 43634
mysqld-nt: ready for connections.
Version: '4.1.20-community-nt'  socket: ''  port: 3306  MySQL Community Edition

which just sat there.
[28 Jun 2006 21:08] MySQL Verification Team
Thank you for the feedback. Ok you was able for to start the server as
standalone without error however you did with the server mysqld-nt.exe
and the service binary is:

 BINARY_PATH_NAME   : "C:\Program Files\MySQL\MySQL Server

so verify if you have the mysqld-max-nt in the bin directory.
[29 Jun 2006 12:20] Dennis Foreman
I don't have the mysqld-max-nt program.
[29 Jun 2006 12:44] MySQL Verification Team
Thank you for the feedback. If the service was working before that means
that the mysqld-max-nt.exe was removed/deleted from the bin directory
and the service fails for this reason, so I am changing the status as
not a bug. You have the below option:

- Get the mysqld-max-nt binary downloading the non-installer package
  and to put it in the bin directory.


- To remove the service: mysqld-nt --remove MySQL and install the service with
  mysqld-nt.exe with the option --defaults-file="path_my.ini". For that

  mysqld-nt --install MySQL --defaults-file="path_for_my.ini"
[29 Jun 2006 19:08] Dennis Foreman
Extracting mysqld-max-nt.exe into the mysql\bin folder solved the problem, (THANK YOU), but I still have 3 questions: 
1. since I did not delete that file myself, could there be some setting somewhere that could make it go away?
2. why can the error message give me the error code (code 2) but can't tell me which file was missing (since it knows there IS one missing, it must know which one it was looking for)?
3. why does the error say "the system" cannot find the file, instead of saying "mysql" can't find it. "The system" makes it seem as if Windows is to blame.
[29 Jun 2006 21:25] MySQL Verification Team
Thank you for the feedback.
Question 1:
I can't say you which was the reason why that file was removed. If you
want to have control about that or to track the reason for, search
for Windows Administration Tool which was designed for that purpose.

Question 2:
Windows gave you the correct message error and the way to find which
file is missed, it is how I showed you: sc qc service_name and look
for the service binary path.
This is the same if you open a DOS prompt go to the bin directory and try to start the server with a typo in its name:
PS C:\mysql\bin> mysqld-mx-nt --standalone --console
'mysqld-mx-nt' is not recognized as a cmdlet, function, operable program, or script file.
At line:1 char:13
+ mysqld-mx-nt  <<<< --standalone --console

Question 3:
MySQL can't give you an error message for this case, the service failed
for to find the server i.e: if you delete the host.frm file in the data
directory MySQL will gives you and error message about but in this case
the service started the server binary.

So all your questions belongs to Windows Administration issue.
[6 Nov 2013 3:20] David Fallas
HI i did an update on my MySQL instalation from to 5.7 version.
This is the end of the installer.log:
mysql-installer Information: 10 : Beginning installation of mysql-server-5.7-winx64 with options ALLUSERS=1 INSTALLDIR="C:\Program Files\MySQL\MySQL Server 5.7\" INSTALLLOCATION="C:\Program Files\MySQL\MySQL Server 5.7\" ARPINSTALLLOCATION="C:\Program Files\MySQL\MySQL Server 5.7\"  DATADIR="C:\ProgramData\MySQL\MySQL Server 5.7\" 
mysql-installer Information: 10 : mysql-server-5.7-winx64's change state request passed.
mysql-installer Information: 10 : Reading optional parameters for product {27FA07B8-79D3-455C-99ED-A2830865290F}
mysql-installer Information: 10 : Product configuration controller initialization started.
mysql-installer Information: 10 : Product configuration controller found mysql-server-5.7-winx64 installed.
mysql-installer Information: 10 : Product configuration controller creating new template instance.
mysql-installer Verbose: 5 : 05/11/2013 07:44:08 p.m. - Attempting to start MySQL57 service.
mysql-installer Critical: 100 : Cannot start service MySQL57 on computer '.'.
mysql-installer Information: 10 : Saving configuration.

Now I can not initiate MySQL service anymore. I got the error mentioned in this log... I tried to follow up instructions but I couldn't run service as stand alone...

Help please... I urgently need to backup my database files for moving them into the real sever...