Bug #112382 Update mysql server with yum/dnf ensures service is always enabled
Submitted: 19 Sep 2023 6:29 Modified: 8 Nov 2023 21:47
Reporter: Toshiyuki Goto Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:8.0.34 OS:Red Hat
Assigned to: CPU Architecture:Any

[19 Sep 2023 6:29] Toshiyuki Goto
Description:
With MySQL installed using RPM from YUM repository, even if service is disabled after installation, it will be changed to enable when updating.

How to repeat:

```
cat /etc/redhat-release
#=> Red Hat Enterprise Linux release 9.2 (Plow)

dnf install -y https://dev.mysql.com/get/mysql80-community-release-el9-4.noarch.rpm
dnf install -y mysql-community-server-8.0.33

systemctl is-enabled mysqld.service
#=> enabled

systemctl disable mysqld.service

systemctl is-enabled mysqld.service
#=> disabled

dnf update -y mysql-community-server

systemctl is-enabled mysqld.service
#=> enabled
```

As a workaround, can block service from becoming enable with `systemctl mask mysqld.service`.

```
systemctl mask mysqld.service

systemctl is-enabled mysqld.service
#=> masked

dnf update -y mysql-community-server

systemctl is-enabled mysqld.service
#=> masked
```

Suggested fix:
I think following line in spec file is unnecessary.

> https://github.com/mysql/mysql-server/blob/057f5c9509c6c9ea3ce3acdc619f3353c09e6ec6/packag...

just want to enable service during initial installation, you can use [systemd.preset](https://www.freedesktop.org/software/systemd/man/systemd.preset.html).

Alternatively, you can use the following conditional branch to enable it only during new installations.

```
if [ $1 -eq 1 ]; then
    /usr/bin/systemctl enable mysqld >/dev/null 2>&1 || :
fi
```
[19 Sep 2023 12:06] MySQL Verification Team
Hi Mr. Goto,

Thank you for your bug report.

However, we do not have control over how other companies build MySQL.

Please try a suitable MySQL package from our repository for your operating system.

Not a bug.
[19 Sep 2023 19:15] Terje Røsten
Hi!

Thanks for your report!

We want to enable service on install, however not on upgrade.
[8 Nov 2023 21:47] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Server 8.0.36 and 8.3.0 releases, and here's the proposed changelog entry from the documentation team:

Upgrading MySQL using an official MySQL Yum or SUSE repository would
always enable the MySQL service. Now it only enables the service after
installing, and preserves (does not edit) the existing value while
upgrading.

Thank you for the bug report.