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
Moving mysqld to "complain" group was not enough in my case (MariaDB 10.1.21 running on Ubuntu 16.04). I had to fully disable apparmor for mysqld:
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ sudo service apparmor reload sudo service mysql restart
Now everything works fine.