MySQL Server on Truenas

Setting up MySQL Server for Kodi (or other devices) on truenas.

This little guide is howto create en jail from scratch and then install mysql server – so my kodi devices will use this dataase for updateting watched movies or new movies etc. This is actually quite easy and very nice if you have more than one kodi device and one storage for all. its required here that you have an already running Freenas. S0 here’s what I did

  • Login in to theTruenas Administration interface and go to the menu Jails.
  • Create a new Jail -Called MySQL – release 11.2 ( this will take som time)
  • Use freenas shell – or use SSH to login to your Freenas shell.
  • change to your new create jail –jexec (PID)

 

pkg update -f
pkg upgrade
pkg install mysql80-client-8.0.16_1 mysql80-server-8.0.16
sysrc mysql-server_enable=yes
service mysql-server start
mysql_secure_installation

this will install the MySQL server and client on the jail, and start the MySQL service from boot – and start the MySQL service. And actually the MySQL is mariadb. but it’ll still works 🙂
If needed any special tweaks for running your MySQL server – create your my.cnf and place it in /usr/local/etc/my.cnf. Then Mine looks like this:

[mysqld]
datadir = /var/db/mysql
sock = /var/db/mysql/mysql.sock
pid-file = /run/mysql/mysql.pid
log-error = /var/db/mysql/mysql-error.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /var/db/mysql/mysql-slow.log
bind-address = 172.16.10.60
skip_name_resolve = 1

And you can add other configuration to that file – but this is where MySQL on Truenas are looking for it.