[MDEV-32166] mysql_install_db creates mysql_upgrade_info file with different owner Created: 2023-09-14 Updated: 2024-01-08 Resolved: 2024-01-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.4, 10.8.8, 10.7, 10.5.22, 10.6.14, 10.6.15, 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Hartmut Holzgraefe | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
When running mysql_install_db with --user=... option all files in the created datadir will be owned by the given user, with the exception of mysql_upgrade_info which is owned by the user that executed the script, e.g.:
|
| Comments |
| Comment by Hartmut Holzgraefe [ 2023-09-14 ] |
|
Only tested on latest 10.11 so far, but probably effects all versions after |
| Comment by Hartmut Holzgraefe [ 2023-09-14 ] |
|
Another reason for not having this info in a file, but in the database itself ... |
| Comment by Sergei Golubchik [ 2023-09-14 ] |
|
why is it a bug? |
| Comment by Hartmut Holzgraefe [ 2023-10-16 ] |
|
From KB on the "--user" option: "The login user name to use for running mysqld. Files and directories created by mysqld will be owned by this user." I know that this specific file is not created by mysqld/mariadbd, but the average user wouldn't necessarily know, and may get confused by ownership of this one specific file in the datadir not being affected. Also this breaks things if a user lager chooses to run mysql_upgrade as the regular database system user ("mysql") instead of as ("root"), even though mysql_upgrade should not require root privileges otherwise |
| Comment by Sergei Golubchik [ 2023-10-16 ] |
|
mysql_upgrade_info is owned by the user that mariadb-upgrade was run under. It's not really specific to mariadb-install-db, one can run mariadb-upgrade after installation as root and then as some other user, and get exactly the same issue. So, basically, you're saying that mariadb-upgrade should chown the file it creates in the datadir to be owned by the owner of the datadir. Is that the desirable behavior? |
| Comment by Daniel Black [ 2023-10-17 ] |
|
When the file exists, mariadb-upgrade rewrites the file contents, so fixing mariadb-install-db is desirable to get the base file right. When the file doesn't exist, yes changing the ownership to the datadir owner sound like a good addition too. |
| Comment by Sergei Golubchik [ 2023-11-20 ] |
|
why is it a good addition? what is the goal, to allow someone to run mariadb-upgrade alternately as root and as mysql user? Like on even weeks as root and on odd weeks as mysql? Is this what you're trying to get working? |