[MDEV-7021] mysql_install_db.exe does not allow to specify template file for mysqld/mariadbd settings Created: 2014-11-04  Updated: 2022-03-07  Resolved: 2020-05-18

Status: Closed
Project: MariaDB Server
Component/s: Platform Windows
Fix Version/s: 10.6.0

Type: Task Priority: Major
Reporter: VAROQUI Stephane Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-24372 Unable to set aria_block_size on Wind... Closed
Relates
relates to MDEV-24478 Document mysql_install_db.exe --confi... Stalled

 Description   

When upgrading from MySQL to MariaDB on windows from the Zip file it would be convenient to to create the windows service with an existing configuration file that could be pass by a new --defaults-file option

Other than that the my.ini will be set to the basedir or on dummy datadir pass to the mysql_install_db.exe command



 Comments   
Comment by Elena Stepanova [ 2015-11-01 ]

I'm still not quite sure why it is a bug, but since serg switched it to one twice, I assume it is.
Maybe the bug is that our version of mysql_install_db on Windows does not support --defaults-file option? That makes sense, but even if it did, it would have to mean the same thing as it does in the Linux version – the file where mysql_install_db itself reads its parameters from, which is not what was requested.
Maybe it could do both if a service is being installed? It does sound like a new feature, though.
Assigning to wlad who will surely figure it out (and adding this comment mostly for myself, so that I don't attempt to turn it into a task for the 3rd time).

Comment by Vladislav Vaintroub [ 2015-11-03 ]

My guess is that stephane@skysql.com is asking mostly for the functionality we have in mysql_upgrade_service.exe , which is not about creating a completely new database but to change a windows service to run under mysqld.exe from another installation . we also run mysql_upgrade, so the user does not have to do it afterwards.

The reason I chose not to provide this functionality for non-service instances is that it is impossible to figure out how this database is actually run. We cannot just lookup for the batch file used to start the database and change the path of mysqld.exe there. With Windows service everything is clear, all stuff we know about this particular instance is in the service config, and in the defaults file.

On the other hand maybe I'm mistaken and Stephane is asking for a "template" my.ini for the new installation, so the user does not have to modify it post-install. This might be a valid request for enhancement

Asking stephane@skysql.com for clarification.

Comment by VAROQUI Stephane [ 2015-11-03 ]

Correct i use zip install to enable 2 services running on the same datadir , so that the user can switch from mysql to mariadb and back .

Comment by Vladislav Vaintroub [ 2015-11-03 ]

Thanks for the clarificaton! Without upgrade it seems a bit dangerous

just registering the service can be done in several ways, the simplest of which is when mysqld.exe registers the service itself

https://dev.mysql.com/doc/refman/5.7/en/windows-start-service.html mentions this
In elevated command prompt

C:\> "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld"
          --install MySQL --defaults-file=C:\my-opts.cnf

Also , Windows utility sc.exe can be used . ccalender wrote a blog about it, http://www.chriscalender.com/syntax-for-creating-a-windows-service-for-mysql-when-there-are-2-paths-which-both-contain-spaces/ ( it can get funny with spaces in path)

So registring service itself does not seem to be a big deal?

Comment by VAROQUI Stephane [ 2015-11-04 ]

Thanks for the links

Comment by Vladislav Vaintroub [ 2020-05-12 ]

The tricky part of that is to ensure that file permissions are correct, no matter which weird options for directory and file placement are in custom my.ini
unlike the unix script mysql_install_db.exe always had to ensure that if service is created, the files have the correct permissions - the unprivileged service user (which is going to be NT SERVICE\service_name in 10.6) needs full access to the files that were created by another privileged user during bootstrap
The bootstrap user is either LocalSystem when MSI runs, or elevated admin when mysql_install_db.exe runs standalone.

BTW I hesitate to call the new parameter --defaults-file, the unix script, to which this tool does not need to be compatible even, uses --defaults-file in the most surprising way possible, breaking all user expectations of what --defaults-file does. hholzgra , you may want to comment on that

Comment by Vladislav Vaintroub [ 2020-05-18 ]

the new parameter is called --config. it points to a "template" config file, which is still copied into datadir, and possibly modified by adding various things like port and such.

Comment by Ian Gilfillan [ 2020-12-23 ]

Created MDEV-24478 to document this.

Generated at Thu Feb 08 07:16:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.