Bug #49261 --defaults-file can't use for install mysqld as an service
Submitted: 1 Dec 2009 13:25 Modified: 10 Dec 2009 16:05
Reporter: Honest Qiao Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.4.3-beta-community OS:Windows (WindowsXP-32)
Assigned to: Alexander Nozdrin CPU Architecture:Any
Tags: server config defaults-file

[1 Dec 2009 13:25] Honest Qiao
Description:
OS:Windows7
MySQL:5.4.3-beta-community MySQL Community Server

On http://dev.mysql.com/doc/refman/5.4/en/option-files.html#option_general_defaults-file , I get how to use defaults-file.

cmd.exe
===============================================
#cd f:\usr\local\mysql5.4.
#bin\mysqld.exe --install MYSQL --defaults-file=f:\usr\local\mysql5.4\my.ini
install ok
But, net start MYSQL will abort.
mysqld error log show:
F:\usr\local\mysql5.4\bin\mysqld.exe: Too many arguments (first extra is 'F:\usr\local\mysql5.4\my.ini').
Use --verbose --help to get a list of available options
091201 20:11:13 [ERROR] Aborting

If I use 
#bin\mysqld.exe --defaults-file=f:\usr\local\mysql5.4\my.ini --console 
mysqld will run ok.

If I use bin\mysqld.exe --install MYSQL
net start MYSQL will work.

The similar bug is http://bugs.mysql.com/bug.php?id=46794

Use MySQL5.1 , in windows services manager , mysqld server is:
"F:\usr\local\mysql5.1\bin\mysqld" --defaults-file="F:\usr\local\mysql5.1\my.ini" APM_MySQL5.1
But MySQL5.4 is:
"F:\usr\local\mysql5.4\bin\mysqld" "F:\usr\local\mysql5.1\my.ini" APM_MySQL5.4
less parameter name named --defaults-file.

How to repeat:
bin\mysqld.exe --install MYSQL --defaults-file=f:\usr\local\mysql5.4\my.ini
net start MySQL
type data\servername.err

Suggested fix:
IN sql/mysqld.cc line 4678:
    /* 
     Add option after file_path. There will be zero or one extra option.  It's
     assumed to be --defaults-file=file but isn't checked.  The variable (not
     the option name) should be quoted if it contains a string.
    */
[1 Dec 2009 14:26] Peter Laursen
looks like a duplicate of 
http://bugs.mysql.com/?id=46870

.. but what situation is with 5.4.3 (identical to 5.1 before or after latest fix) I do not know
[1 Dec 2009 15:38] Tonci Grgin
And here comes same guy to check on this...

Hi Honest and thanks for your report. Verified just as described using 5.4.3 x64 zip on Win7 Ultimate x64.

Since Windows network crashed (I tend to blame W2K8 primary box for this, and I can't express what I really think of this "server" OS in terms appropriate for BugsDB :( ) I'm unable to attach any more info. However, issue is more than easy to reproduce.
[2 Dec 2009 5:36] Honest Qiao
reproduce on windowsxp-x32.
The same method to install mysql5.4 as an windows service,
and net start mysql5.4, will get 1067 abort.

On Windowx7 or WinXP-x32,use mysql5.0.x,mysql5.1.x,mysql6.x, mysqld work ok.
[2 Dec 2009 8:00] gao yang
f:\usr\local\mysql5.4>bin\mysqld.exe --install MYSQL54 --defaults-file=f:\usr\lo
cal\mysql5.4\my.ini
Service successfully installed.

f:\usr\local\mysql5.4>net start MYSQL54
The MYSQL54 service is starting.
The MYSQL54 service could not be started.

A system error has occurred.

System error 1067 has occurred.

The process terminated unexpectedly.

My OS is windows7 Ultimate 64bit
[2 Dec 2009 11:01] Tonci Grgin
Gao, Honest, you might wish to paste contents of \Data\your_server_name.err file.
[8 Dec 2009 8:40] Alexander Nozdrin
I can not repeat this bug on Windows XP SP3 32bit with 5.5.0 (mysql-trunk):

E:\Q w e\mysql-trunk-bugfixing\sql\Debug>mysqld.exe --install MYSQL --defaults-file="C:\Program Files\my.cnf"
Service successfully installed.

E:\Q w e\mysql-trunk-bugfixing\sql\Debug>net start MYSQL
Service "MYSQL" is starting..........
Service "MYSQL" started.

E:\Q w e\mysql-trunk-bugfixing\sql\Debug>net stop MYSQL
Service "MYSQL" is stopping.
Service "MYSQL" stopped.

E:\Q w e\mysql-trunk-bugfixing\sql\Debug>mysqld.exe --remove MYSQL --defaults-file="C:\Program Files\my.cnf"
Service successfully removed.
[8 Dec 2009 8:56] Tonci Grgin
Alik, the bug is reported:
  o against MySQL server 5.4 (ok, I see target version...)
  o on x64 platform
  o using Windows 7

If you are sure it is ok to close this report relaying on your test, please do so.
[8 Dec 2009 9:14] Alexander Nozdrin
Tonci,

the next version for 5.4.3 is 5.5.0. And then we'll have 5.5.1.
There will be no 5.4.4 AFAIU.

The reporter complained also about WinXP 32bit, and the OS field
has "Microsoft Windows (WindowsXP-32)".

Based on that, I thought, I can close it.
However, I will double check on Win7 64bit in a few days when I come home.
[8 Dec 2009 9:21] Tonci Grgin
Thank you very much Alik.
[10 Dec 2009 16:05] Alexander Nozdrin
I've checked it on Windows 7 64bit.
Still, it works (note I used a terminal started as Administrator):

F:\Home\Q w e>mysqld.exe --install MYSQL --defaults-file="F:\Home\Q w e\my.cnf
Service successfully installed.

F:\Home\Q w e>net start MYSQL
The MYSQL service is starting.
The MYSQL service was started successfully.

F:\Home\Q w e>net stop MYSQL
The MYSQL service is stopping.
The MYSQL service was stopped successfully.

F:\Home\Q w e>mysqld.exe --remove MYSQL --defaults-file="F:\Home\Q w e\my.cnf"
Service successfully removed.