Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7021

mysql_install_db.exe does not allow to specify template file for mysqld/mariadbd settings

Details

    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

      Attachments

        Issue Links

          Activity

            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).

            elenst Elena Stepanova added a comment - 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).
            wlad Vladislav Vaintroub added a comment - - edited

            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.

            wlad Vladislav Vaintroub added a comment - - edited 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.

            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 .

            stephane@skysql.com VAROQUI Stephane added a comment - 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 .
            wlad Vladislav Vaintroub added a comment - - edited

            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?

            wlad Vladislav Vaintroub added a comment - - edited 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?

            Thanks for the links

            stephane@skysql.com VAROQUI Stephane added a comment - Thanks for the links

            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

            wlad Vladislav Vaintroub added a comment - 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

            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.

            wlad Vladislav Vaintroub added a comment - 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.
            greenman Ian Gilfillan added a comment -

            Created MDEV-24478 to document this.

            greenman Ian Gilfillan added a comment - Created MDEV-24478 to document this.

            People

              wlad Vladislav Vaintroub
              stephane@skysql.com VAROQUI Stephane
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.