[Unit] Description=MySQL database server After=syslog.target After=network.target [Service] Type=notify User=mysql Group=mysql NotifyAccess=main ExecStartPre=/usr/sbin/mysqld-prepare-db-dir ExecStart=/usr/sbin/mysqld # mysqld-prepare-db-dir needs root rights, this drops privileges only for ExecStart PermissionsStartOnly=true # Give a reasonable amount of time for the server to start up/shut down TimeoutSec=300 # We rely on systemd, not mysqld_safe, to restart mysqld if it dies Restart=always [Install] WantedBy=multi-user.target