Auto-restart MariaDB after crash

Open file in nano (or other text editor) from root user:

nano /etc/systemd/system/multi-user.target.wants/mariadb.service

Change parameters in file:

# Restart crashed server only, on-failure would also restart, for example, when
# my.cnf contains unknown option
Restart=always
RestartSec=45s

Restart daemons:

systemctl daemon-reload
systemctl restart mariadb.service