[Unit] Description=MySQL database server [Service] ExecStartPre=/bin/sh -c 'test "`ls -1 /var/lib/mysql | wc -l`" != "0" || mysql_install_db --basedir=/usr --datadir=/var/lib/mysql' ExecStartPre=!install -d -o mysql -g root -m 0755 /var/log/mysql ExecStart=/usr/bin/mysqld_safe --log-error=/var/log/mysql/mysqld.log Restart=always User=mysql RuntimeDirectory=mysql RuntimeDirectoryMode=0755 Type=notify NotifyAccess=all [Install] WantedBy=multi-user.target