First of all, install MariaDB
sudo apt-get update && sudo apt-get install mariadb-server
Next, create a new database, it's probably safe to use root for ownCloud, since it's localhost only. But make a user if you're a paranoid android.
Give the user permissions to the database:
GRANT ALL PRIVILEGES ON owncloud.* To 'owncloud'@'localhost' IDENTIFIED BY 'password';
Next, go to your ownCloud directory, mine is:
Run the following command, be sure to change the settings to whatever it is you have setup:
php occ db:convert-type [options] type username hostname database
sudo php occ db:convert-type --all-apps mysql owncloud 127.0.0.1 owncloud
When it asks you to confirm going ahead, you need to type “yes” and hit enter. Else it won't work.
For some reason, when I did this, ownCloud started to be a dick and tell me that it didn't have write permissions to the config directory, so I also did this:
cd /var/www sudo chmod -R 755 owncloud/ sudo chown -R www-data:www-data owncloud/
This allowed ownCloud to be able to write using the Apache user.