[Unit]
Description=MySQL Database
After=network.target
Before=syslog.target httpd.service postfix.service dovecot.service dbmail-imapd.service dbmail-lmtpd.service dbmail-pop3d.service dbmail-postfix-policyd.service

[Service]
Type=simple
PIDFile=/var/run/mysqld/mysqld.pid
ExecStart=/usr/libexec/mysqld --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock --user=mysql
ExecStop=/bin/kill -15 $MAINPID
Restart=always
RestartSec=2
TimeoutSec=60
ExecStartPost=/bin/sleep 2

[Install]
WantedBy=multi-user.target

# WE DO NOT KNOW HOW TO INCLUDE SOMETHING LIKE THIS TO MAKE "largepages" WORKING
# [root@srv-rhsoft:~]$ cat /etc/my.memory.cnf
# echo 200 > /proc/sys/vm/nr_hugepages
# echo 27 > /proc/sys/vm/hugetlb_shm_group
# echo 2097152 > /proc/sys/kernel/shmall
# ulimit -l unlimited
# ulimit -n 30000
# InnoDB: HugeTLB: Warning: Failed to allocate 109051904 bytes. errno 1
# InnoDB HugeTLB: Warning: Using conventional memory pool

# WE HOPE THAT "ExecStartPost=/bin/sleep 2" RESULTS IN A DELAY BEFORE STARTING SEVICES DEPENDING ON
# MYSQL BECAUSE A SUCCESSFULL START DOES NOT MEAN THAT MYSQL IS READY FOR CONNECTIONS AND SOME 
# MAILSERVICES IN MYSQL-DRIVEN ENVIRONEMNTS ARE FAILING IF STARTED TOO SOON