I set up my first Ubuntu Server with Ubuntu 16.04, nginx, php7.0, MariaDB, nextcloud and external DynDNS using this tutorial here: Install Nextcloud 9 on Ubuntu 16.04
I also faced the same issue. You need to set appropriate timeout in the systemd config for mariadb service. Below solved same for me. for ex. When system requires SST it may take long time for mariadb service to come up causing the timeout in systemd.
If you are using systemd 228 or older, then you can execute the following to set an infinite timeout.
sudo tee /etc/systemd/system/mariadb.service.d/timeoutsec.conf <
For other options please refer to https://mariadb.com/kb/en/systemd/