How to override a property in a Systemd unit

Sometimes you install a package with a Systemd service unit, but you want to override a property. To do this, run the following:

sudo systemctl edit mariadb.service

Add the stuff you want to override, such as:


Then save the file. This will create a new file in:


Restart the service:

sudo systemctl daemon-reload
sudo systemctl restart mariadb.service

You can verify it works by:

[cbrake@xyz ~]$ sudo systemctl show mariadb | grep Restart=

This is handy tip, it can also be used when building offline images like we do with yocto e.g. /etc/systemd/system/mariadb.service.d/override.conf can be emitted via a bbappend and packaged into final image.