I would strongly recommend you try setting up your servers using the owncloud ansible roles:
This will seperate out the data directory by default, if you point the mariadb against a separate server, it will set it up with the right parameters. All you’d have to do is adjust the mysql user to allow access from a different host.
Additionally all configuration will be set to ownCloud best practices by default. However I do understand that using ansible is not the easiest for Linux beginners. Perhaps try it out on a VM first, …