When I try to give access for mariadb to access my home dir, thats always fail
I don’t know what happen but when I edit mariadb.service with
sudo systemctl edit mariadb.service
and change
`ProtectHome=true to ProtectHome=false’
and save, whenever I check again thats line return to default(ProtectHome=true), can anyone help me to clear this problem? the text editor i use is nano
While I know literally nothing about mariadb, I have seen similar things.
Stop the database / the service before you edit the file?
Configure access to home directories
For security reasons, the systemd service file contains ProtectHome=true
, which prevents MariaDB from accessing files under the /home
, /root
and /run/user
hierarchies. The datadir
has to be in an accessible location and owned by the mysql
user and group.
You can modify this behavior by creating a supplementary service file as described here.
– MariaDB - ArchWiki
I understand the above as
- yes you can use a folder within your home as datadir
- but the folder you use must be owned by mysql:mysql
- and you need to create an override as described in the link
I did that, but the configuration always turn into default
I seriously can’t believe that.
Editing a file is editing a file.
…
How about you editing the the actual service file.
Not through systemctl edit.
just by opening and altering the fie itself - wherever it might be
Yeah, I agree with that, the problem that even I edit the file the result always same, I found the file in /usr/lib/systemd/system/mariadb.service, I change ProtectHome=true to ProtectHome=false, when I directly edit to file the changes is success but not the effect, mariadb still use default setting ProtectHome=true even when I change that to false, have advice?
But
what you described was:
you edit the file
and
the edit does not stick
… which actually and in almost no scenario can’t be true …
This seems to go towards a different scenario:
an XY problem
What is it that you eventually want to achieve?
Files is /usr will be overwritten after updating the owning package. This is not where custom edits go to.
Use systemctl edit mariadb
thats what he said he did - but the edit somehow didn’t stick
no, actually , he said he tried to edit the mariadb.service file
and no matter what, the edit to it would not “stick”
The actual file is not changed, it creates a drop-in file which settings overwrite the original ones.
It should be somewhere it /etc/systemd/systemd/mariadb.service.d/override.conf
.
(Depending on how OP actually changed file or just edited the commented part of the newly created buffer.)
mkay
If I edit a file
I expect it to reflect the change after the edit.
This is not true here in this case?
I guess they actually did not edit the file. Or rather looked at the wrong file.
systemctl edit mariadb.service will create a new file. The contents in the original file that provides the unit will not be changed.
systemctl edit
will not edit any files, specially no files in /usr
.
The edit command will create an override file in a matching service.d folder in /etc/systemd/system/
. You can use the systemctl status
command for a service to check if the override file was loaded. Keep in mind that you need to add section identifier, like [Service]
, and the values you want to add or override.
You can use the --full
( or the old -all
, but only one dash!) option. This will copy the service file to /etc/systemd/system/
and let you edit the copied file.
This is one of the few systemctl commands that can’t get elevate permissions via polkit, which means you need to start it with sudo or something similar.
See
https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#edit%20UNIT…
… but he said he used the nano
editor to edit that file
I don’t care anymore - we need feedback.
systemctl edit
will open the default terminal editor. By default, this is nano.
I know.
and I started with:
I will be leaving this thread right now
and only observe it from now on.
It’s not a mariadb error but rather systemd.
But this
I am sorry, first problem(when I can’t edit is solve) but the main problem is still not solved
I did that, and still no change