[MDEV-19358] Remove service registration code from mysqld.exe Created: 2019-04-29 Updated: 2020-07-01 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Platform Windows |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Vladislav Vaintroub | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | beginner-friendly | ||
| Issue Links: |
|
||||||||||||
| Description |
|
Windows specific functionality "mysqld --install" , "mysqld --remove" should not be used anymore. This functionality is deprecated since we have mysql_install_db.exe, i.e 5.5. mysql_install_db.exe does the service registration and more. Removing a service is a simple call to "sc delete <service_name>". Also the logic "if mysqld.exe was started without parameters, lookup for MySQL service name and start it, if exists", this should be removed. |
| Comments |
| Comment by Sergei Golubchik [ 2019-08-06 ] |
|
couldn't it break existing installations that use, say, "mysqld.exe was started without parameters" ? |
| Comment by Michael Widenius [ 2019-09-17 ] |
|
What is the benefit for removing the options ? |
| Comment by Vladislav Vaintroub [ 2019-09-17 ] |
|
serg, mysql_upgrade_service would take care of that, iirc already does. Besides, "mysqld --install" would run service as LocalSystem account, the most powerful Windows account, comparable to Unix root, which is a security problem. mysql_install_db,exe, on the other hand, makes mysqld run under the least privileged Windows service account NetworkService, and it has to set the ACL of the datadir explicitly to make files writable for NetworkService. |
| Comment by Dominique Ottello [ 2020-07-01 ] |
|
I agree with "mysqld.exe --remove myservice" which can be replaced by the Windows command "sc delete myservice", but I absolutely don't agree with the removal of "mysqld.exe --install-manual myservice" that nothing replaces at the moment. Otomatic - Dominique Ottello |
| Comment by Vladislav Vaintroub [ 2020-07-01 ] |
|
Otomatic. "sc create" can do this, can't it? Here is an old post of my colleague Chris The question is why do you want to run server without data directory. How do you bootstrap (create system tables), with the good old way? |
| Comment by Dominique Ottello [ 2020-07-01 ] |
|
sc create wampmariadb64 binPath="E:\wamp64\bin\mariadb\mariadb10.5.4\bin\mysqld.exe --defaults-file=E:\wamp64\bin\mariadb\mariadb10.5.4\my.ini" |
| Comment by Vladislav Vaintroub [ 2020-07-01 ] |
|
Did you read that post attentively You need to add service name at the end of binPath "E:\wamp64\bin\mariadb\mariadb10.5.4\bin\mysqld.exe --defaults-file=E:\wamp64\bin\mariadb\mariadb10.5.4\my.ini wampmariadb64" How do you think server would know that it is started as which service? It derives it from the last command line parameter |
| Comment by Dominique Ottello [ 2020-07-01 ] |
|
data directory is created when installing different versions of MariaDB and, to switch from one version to another the actions are :
|
| Comment by Vladislav Vaintroub [ 2020-07-01 ] |
|
Why do you delete and recreate the service ? What's the point? |
| Comment by Dominique Ottello [ 2020-07-01 ] |
|
I didn't read the message "attentively" because it was changed after I read it... After rereading, this: |
| Comment by Dominique Ottello [ 2020-07-01 ] |
|
> Why do you delete and recreate the service ? What's the point? |
| Comment by Vladislav Vaintroub [ 2020-07-01 ] |
|
I meant, reading "Chris' blog post" attentively . this blog post has not changed since 2012. It describes the very same problem you just had, gives an explanation, why binpath should add the servicename at the end. Also note you can't always switch versions by simply restarting with new executables. if you upgrade from 10.4 to 10.5 for example, you need to stop the server with "innodb slow shutdown" (--innodb-fast-shutdown=0), and you likely need to run And mysql_upgrade_service takes care of all that, given that executables for the new version are in a different path. and of course, it also takes care of changing service's binPath. |
| Comment by Vladislav Vaintroub [ 2020-07-01 ] |
|
So, would it be correct to state that you were requesting that "mysqld --install" should continue to live, to manually / partially replicate the logic of mysql_upgrade_service? Why not just to use mysql_upgrade_service as-is? |
| Comment by Dominique Ottello [ 2020-07-01 ] |
|
> Why not just to use mysql_upgrade_service as-is? E:\wamp64\bin\mariadb\mariadb10.5.4\bin>mysql_upgrade_service --service=wampmariadb64 While it works perfectly for more than fifteen years with mysqld.exe --install-manual and --remove for MariaDB from 5.5.62 to 10.5.4 and for MySQL from 5.1.72 to 8.0.20 |
| Comment by Vladislav Vaintroub [ 2020-07-01 ] |
|
Your solution or upgrade just does not work, on the reason outlined above. |