Bug #26390 4.1.22 install as service problem besides 4.1.0
Submitted: 15 Feb 2007 4:29 Modified: 11 Apr 2007 16:36
Reporter: Abraham Guyt Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:4.1.22 OS:Windows (Windows XP Pro SP2)
Assigned to: CPU Architecture:Any
Tags: service install problem

[15 Feb 2007 4:29] Abraham Guyt
Description:
While trying to add a new 4.1.22 installation to the existing 4.1.0 alpha setup I encountered a weird problem. I use seperate option files for both servers that reside in their respective base dir (so no option file in C:\Windows or C:\).

While the new 4.1.22 server setup runs perfectly as the standalone process using:

mysqld-max-nt --defaults-file=C:\apps\mysql_4_1_22\my.ini --standalone --console

I cannot get the same server binary to run well as a service. Installation done using:

mysqld-max-nt --install --defaults-file=C:\apps\mysql_4_1_22\my.ini

Installation result is OK, but when I try to start the service using:

net start mysql

an error message appears with error code 1067 - which would a wrong default is being used, but apparantly that's not the case, as the standalone option does not reveal a problem at all.

Using the manual option file directive doesn't help either, getting the same error:

net start mysql /--defaults-file=C:\apps\mysql_4_1_22\my.ini

But, surprisingly, just moving the very same option file to C:\Windows\my.ini just solves the problem and the service starts fine.

It seems the new 4.1.22 server can't run as a service well when an option file at a specific location is used.

How to repeat:
Try to setup an installation as described, and install the service with an option file (none in C:\Windows), and try to start the service, or try to start the service with a manual option file directive.

Suggested fix:
Proper handling of non-standard located option files.
[19 Feb 2007 15:35] MySQL Verification Team
Thank you for the bug report. Could you please both my.ini file for
4.1.0 and 4.1.22. Thanks in advance.
[20 Feb 2007 2:46] Abraham Guyt
4.1.0 Alpha option file

Attachment: my.ini (application/octet-stream, text), 2.26 KiB.

[20 Feb 2007 2:46] Abraham Guyt
4.1.22 option file

Attachment: my.ini (application/octet-stream, text), 5.15 KiB.

[20 Feb 2007 2:57] Abraham Guyt
I added the two config files.

Abraham.
[20 Feb 2007 4:09] MySQL Verification Team
Thank you for the feedback. Two notes regarding what are you provided:

1- When you use the --install command to install the service it uses the
   default service name called MySQL. So for the second instance install you
   need to use another service name i.e: MySQL2

    mysqld-nt --install MySQL2 --defaults-file=path_for_my.ini

C:\dbs\4.1\bin>mysqld-nt --help --verbose | findstr service_name
  --install service_name        Install an optional service (NT)
  --install-manual service_name Install an optional service started manually (NT)
  --remove service_name         Remove the service_name from the service list (NT)

2- The 2 my.ini files are using the same port 3306. You can't use the same
   listening port for 2 server instances, so edit the 2nd my.ini file to
   use another port than 3306 i.e: 3307.

Thanks in advance.
[20 Feb 2007 4:43] Abraham Guyt
Miguel,

I know about the different service names and ports. I tried installing them with different service names (in my case mysql410 and mysql4122) but that did not make a difference. The port nr is the same in both files because I did not intend to run the two servers concurrently but alternatively (for development purposes), so the setting for 3306 for both of them would not cause a problem.

Thanks for picking up my bug report by the way. I really look forward to a solution as right now I can only run the 4.1.22 server as a service with the option file in C:\Windows. I used to run the 4.1.0 Alpha server as a service with the option file in the 4.1.0 base directory before I tried the upgrade, that worked fine, but somehow the same doesn't work for 4.1.22.

Could it be that somehow the 4.1.0 and 4.1.22 interfere although there is no single shared option file in C:\ or C:\windows ? Is there a hidden registry setting that might cause confusion ?
[12 Mar 2007 6:28] Abraham Guyt
It seems that 4.1.0 Alpha ignores any --defaults-file directive altogether when starting it as a service like:

net start mysql /--defaults-file="D:\apps\mysql_4_1_0\my.ini"

The defaults file is just ignored and mysql reverts back to standard settings.

Using enclosed " doesn't help either:

net start mysql /"--defaults-file="D:\apps\mysql_4_1_0\my.ini""
[11 Apr 2007 16:36] MySQL Verification Team
Thank you for the feedback. Sorry but I was not able to repeat the
behavior reported:

c:\apps\mysql_4_1_0\bin>mysqld-max-nt --version
mysqld-max-nt  Ver 4.1.0-alpha-max-nt for NT on i32

C:\apps\mysql_4_1_0\bin>mysqld-max-nt --install MySQL1 --defaults-file="c:\apps\mysql_4_1_0\my.ini"
Service successfully installed.

C:\apps\mysql_4_1_0\bin>net start MySQL1
O serviço de MySQL1 está sendo iniciado.
O serviço de MySQL1 foi iniciado com êxito.

C:\apps\mysql_4_1_0\bin>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.0-alpha-max-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show variables like "%dir%";
+---------------------------+----------------------------+
| Variable_name             | Value                      |
+---------------------------+----------------------------+
| basedir                   | c:\apps\mysql_4_1_0\       |
| bdb_logdir                |                            |
| bdb_tmpdir                | C:\Windows\TEMP\           |
| datadir                   | c:\apps\mysql_4_1_0\data\  |
| innodb_data_home_dir      |                            |
| innodb_log_arch_dir       | c:\apps\mysql_4_1_0\iblogs |
| innodb_log_group_home_dir | c:\apps\mysql_4_1_0\iblogs |
| tmpdir                    |                            |
+---------------------------+----------------------------+
8 rows in set (0.00 sec)

mysql>

C:\apps\mysql_4_1_0\bin>sc qc MySQL1
[SC] QueryServiceConfig ÊXITO

NOME_DO_SERVIÇO: MySQL1
    TIPO                       : 10  WIN32_OWN_PROCESS
    TIPO_DE_INÍCIO             : 2   AUTO_START
    CONTROLE_DE_ERRO           : 1   NORMAL
    NOME_DO_CAMINHO_BINÁRIO    : C:\apps\mysql_4_1_0\bin\mysqld-max-nt --defaults-file=c:\apps\mysql_4_1_0\my.ini MySQL1
    GRUPO_DE_ORDEM_DE_CARREG.  :
    MARCA                      : 0
    NOME_PARA_EXIBIÇÃO         : MySQL1
    DEPENDÊNCIAS               :
       NOME_DO_INÍCIO_DO_SERVIÇO  : LocalSystem

C:\apps\mysql_4_1_0\bin>

C:\apps\mysql_4_1_0\bin>cd..

C:\apps\mysql_4_1_0>cd..

C:\apps>cd mysql_4_1_22

C:\apps\mysql_4_1_22>mkdir iblogs

C:\apps\mysql_4_1_22>cd bin

C:\apps\mysql_4_1_22\bin>mysqld-max --install MySQL2 --defaults-file="c:\apps\mysql_4_1_22\my.ini"
Service successfully installed.

C:\apps\mysql_4_1_22\bin>net start MySQl2
O serviço de MySQL2 está sendo iniciado.
O serviço de MySQL2 foi iniciado com êxito.

C:\apps\mysql_4_1_22\bin>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.22-community-max-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show variables like "%dir%";
+----------------------------+--------------------------------------+
| Variable_name              | Value                                |
+----------------------------+--------------------------------------+
| basedir                    | c:\apps\mysql_4_1_22\                |
| bdb_logdir                 |                                      |
| bdb_tmpdir                 | C:\Windows\TEMP\                     |
| character_sets_dir         | c:\apps\mysql_4_1_22\share\charsets/ |
| datadir                    | c:\apps\mysql_4_1_22\data\           |
| innodb_data_home_dir       |                                      |
| innodb_log_arch_dir        | c:/apps/mysql_4_1_22/iblogs          |
| innodb_log_group_home_dir  | c:\apps\mysql_4_1_22\iblogs          |
| innodb_max_dirty_pages_pct | 90                                   |
| tmpdir                     |                                      |
+----------------------------+--------------------------------------+
10 rows in set (0.06 sec)

mysql>

C:\apps\mysql_4_1_22\bin>sc qc MySQL2
[SC] QueryServiceConfig ÊXITO

NOME_DO_SERVIÇO: MySQL2
    TIPO                       : 10  WIN32_OWN_PROCESS
    TIPO_DE_INÍCIO             : 2   AUTO_START
    CONTROLE_DE_ERRO           : 1   NORMAL
    NOME_DO_CAMINHO_BINÁRIO    : C:\apps\mysql_4_1_22\bin\mysqld-max --defaults-file=c:\apps\mysql_4_1_22\my.ini MySQL2
    GRUPO_DE_ORDEM_DE_CARREG.  :
    MARCA                      : 0
    NOME_PARA_EXIBIÇÃO         : MySQL2
    DEPENDÊNCIAS               :
       NOME_DO_INÍCIO_DO_SERVIÇO  : LocalSystem

C:\apps\mysql_4_1_22\bin>mysqld-nt --remove MySQL1
Service successfully removed.

C:\apps\mysql_4_1_22\bin>net stop mysql2
O serviço de MySQL2 está sendo finalizado ..
O serviço de MySQL2 foi finalizado com êxito.

C:\apps\mysql_4_1_22\bin>mysqld-nt --remove MySQL2
Service successfully removed.

C:\apps\mysql_4_1_22\bin>