diff options
| author | Felix Uhl <github@mail.felix-uhl.de> | 2024-07-31 15:49:23 +0200 |
|---|---|---|
| committer | Felix Uhl <github@mail.felix-uhl.de> | 2024-07-31 15:49:23 +0200 |
| commit | 10538b82df08bf719c388bd937ec550c9ec8ddf7 (patch) | |
| tree | 512c2918a8cf0d73b52fd27c526217ebad64fa61 /pkgs/development/python-modules/rangehttpserver | |
| parent | 038fb464fcfa79b4f08131b07f2d8c9a6bcc4160 (diff) | |
nixos/mysql: fix permission error during first startup
When mysql starts up for the first time, the binary `mysql_install_db`
will run and try to set up the correct folder structure and permissions.
The very first step is to change the owner and group of the data
directory. This can fail in some cases, for example if `cfg.dataDir` is
something like `/mnt/mysql`:
```
Jul 31 15:24:35 junction systemd[1]: Starting MySQL Server...
Jul 31 15:24:36 junction mysql-pre-start[1346]: chown: changing ownership of '/mnt/mysql': Operation not permitted
Jul 31 15:24:36 junction mysql-pre-start[1309]: Cannot change ownership of the database directories to the 'mysql'
Jul 31 15:24:36 junction mysql-pre-start[1309]: user. Check that you have the necessary permissions and try again.
Jul 31 15:24:36 junction systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Jul 31 15:24:36 junction systemd[1]: mysql.service: Failed with result 'exit-code'.
Jul 31 15:24:36 junction systemd[1]: Failed to start MySQL Server.
```
This is because `/mnt` usually is owned by root.
To work around this issue, use `systemd.tmpfiles` to set the owner,
group and permissions. This will always work, and if the permissions are
already set as expected, mysql will not try to alter them again.
Diffstat (limited to 'pkgs/development/python-modules/rangehttpserver')
0 files changed, 0 insertions, 0 deletions
