move /usr/lib/systemd/system/mariadb.service to /etc/systemd/system/mariadb.service
Then under the [Service] section in the file add the following line:
OOMScoreAdjust=-1000
Then run:
systemctl daemon-reload
systemctl restart mariadb
To test:
pgrep mysql
pkill mysql
pgrep mysql