Turns out this is quite easy, theres a list of PBI available for AMD64 here:
http://pbibuild64.pcbsd.org/
I downloaded the MariaDB server:
http://ftp.pcbsd.org/pub/pbioutgoing/amd64/9/databases/mariadb-server/mariadb-5.3.12-amd64.pbi
I then upload plugin to FreeNAS, this creates a new jail. Mine was called customplugin_1.
connect to the Jail and run:
vi /etc/rc.confadd the following:
mysql_enable="YES"mysql_limits="NO"mysql_dbdir="/var/db/mysql"
Then run:
service mysql-server start
The server is now started, you now have 2 options.
1. Set the root password manually, run:
/usr/pbi/mariadb-amd64/bin/mysqladmin -u root password 'new-password'2. Run the secure install script:
/usr/pbi/mariadb-amd64/bin/mysqladmin -u root -h customplugin_1 password 'new-password'
/usr/pbi/mariadb-amd64/bin/mysql_secure_installation
You can set the root password, disable root remote access and remove the test database.
I opted for the second option.
You can now create users via the CLI, I used the guide here:
As this is storing my XBMC database only, this is relevant to that. Run:
mysql -pEnter password: *******Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 10Server version: 5.3.12-MariaDB Source distribution
Copyright (c) 2000, 2012, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Then create the user, where user is the username and password is unsurprisingly the password:
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
We now need to add permissions to the database, XBMC creates databases and all the tables so I granted all privileges:
GRANT ALL PRIVILEGES ON * . * TO 'username'@'localhost';
and quit mysql:
quit