{"id":360,"date":"2014-09-16T22:01:42","date_gmt":"2014-09-17T03:01:42","guid":{"rendered":"http:\/\/bourbonnaisservices.com\/blog\/?p=360"},"modified":"2014-09-17T20:29:21","modified_gmt":"2014-09-18T01:29:21","slug":"adding-mysql-server-in-freenas-for-xbmckodi","status":"publish","type":"post","link":"https:\/\/bourbonnaisservices.com\/blog\/2014\/09\/adding-mysql-server-in-freenas-for-xbmckodi\/","title":{"rendered":"Adding MySQL Server in FreeNAS for XBMC\/KODI"},"content":{"rendered":"<p>This is the setup I have used on FreeNAS 9.2.1.7 to setup a MySQL server to function for XBMC soon to be KODI.<\/p>\n<p>Here we go!<\/p>\n<p>Step 1. We want to create a Jail within the FreeNAS webGUI.<\/p>\n<p>&#8211; Jails &#8211;&gt; Add Jails<\/p>\n<p><a href=\"http:\/\/bourbonnaisservices.com\/blog\/wp-content\/uploads\/2014\/09\/newjail.jpg\"><img loading=\"lazy\" class=\"size-full wp-image-361\" src=\"http:\/\/bourbonnaisservices.com\/blog\/wp-content\/uploads\/2014\/09\/newjail.jpg\" alt=\"Freenas\" width=\"548\" height=\"687\" srcset=\"https:\/\/bourbonnaisservices.com\/blog\/wp-content\/uploads\/2014\/09\/newjail.jpg 548w, https:\/\/bourbonnaisservices.com\/blog\/wp-content\/uploads\/2014\/09\/newjail-239x300.jpg 239w\" sizes=\"(max-width: 548px) 100vw, 548px\" \/><\/a><\/p>\n<p>The 3 highlighted areas are the only things that need to be addressed.<br \/>\n1. Naming the jail, in this case MySQL.<br \/>\n2. Make sure you pick standard from the drop down list.<br \/>\n3. Pick an IP address that will correspond to the service.<\/p>\n<p>&nbsp;<\/p>\n<p>Step 2. Logging via SSH to FreeNAS, I currently use Putty (<a title=\"Putty\" href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/download.html\" target=\"_blank\">http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/download.html<\/a>)<\/p>\n<p>Here we are going to install mysql and nano (a text editor), and get the service started.<\/p>\n<p style=\"padding-left: 30px;\"><code> jls\u00a0<\/code><\/p>\n<p>This will give you the ID of the newly created jail<\/p>\n<p style=\"padding-left: 30px;\"><code> jexec ID csh<\/code><\/p>\n<p>Where ID is the number of your jail<\/p>\n<p style=\"padding-left: 30px;\"><code> pkg install mysql55-server<\/code><br \/>\n<code> pkg install nano<\/code><\/p>\n<p>Installing both MySQL and Nano<\/p>\n<p>Now let&#8217;s enable MySQL in rc.conf<\/p>\n<p style=\"padding-left: 30px;\"><code> nano \/etc\/rc.conf<\/code><br \/>\n<code> mysql_enable=\"YES\"<\/code><\/p>\n<p>Save and exit the file<\/p>\n<p style=\"padding-left: 30px;\"><code> service mysql-server start<\/code><br \/>\n<code> mysql_secure_installation<\/code><\/p>\n<p>This will start the service and secure the installation of mysql<\/p>\n<p>Step 3. Creating a user with access for XBMC \/ KODI<\/p>\n<p style=\"padding-left: 30px;\"><code> mysql -u root -p<\/code><br \/>\n<code> GRANT USAGE ON *.* TO 'xbmc'@'%' IDENTIFIED BY 'xbmc';<\/code><br \/>\n<code>flush privileges;<\/code><\/p>\n<p>Now here is the part where we give the user access to create and modify any database needed by XBMC \/ KODI<\/p>\n<p style=\"padding-left: 30px;\"><code>INSERT INTO `mysql`.`db` (`Host`, `Db`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Execute_priv`, `Event_priv`, `Trigger_priv`) VALUES ('%', '%MyVideo%', 'xbmc', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');<\/code><\/p>\n<p style=\"padding-left: 30px;\"><code>INSERT INTO `mysql`.`db` (`Host`, `Db`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Execute_priv`, `Event_priv`, `Trigger_priv`) VALUES ('%', '%MyMusic%', 'xbmc', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');<\/code><\/p>\n<p style=\"padding-left: 30px;\"><code> flush privileges;<\/code><\/p>\n<p>Step 4. Setting up XBMC \/ KODI to use the new database.<br \/>\nSimply open your advancedsetting.xml located in the userdata folder of xbmc \/ kodi<\/p>\n<p>And enter the following:<\/p>\n<p style=\"padding-left: 30px;\">&lt;advancedsettings&gt;<br \/>\n&lt;videodatabase&gt;<br \/>\n&lt;type&gt;mysql&lt;\/type&gt;<br \/>\n&lt;host&gt;192.168.1.200&lt;\/host&gt;<\/p>\n<p style=\"padding-left: 30px;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0&lt;port&gt;3306&lt;\/port&gt;<br \/>\n&lt;user&gt;xbmc&lt;\/user&gt;<br \/>\n&lt;pass&gt;xbmc&lt;\/pass&gt;<br \/>\n&lt;\/videodatabase&gt;<\/p>\n<p>&lt;musicdatabase&gt;<br \/>\n&lt;type&gt;mysql&lt;\/type&gt;<br \/>\n&lt;host&gt;192.168.1.200&lt;\/host&gt;<br \/>\n&lt;port&gt;3306&lt;\/port&gt;<br \/>\n&lt;user&gt;xbmc&lt;\/user&gt;<br \/>\n&lt;pass&gt;xbmc&lt;\/pass&gt;<br \/>\n&lt;\/musicdatabase&gt;<\/p>\n<p>&lt;videolibrary&gt;<br \/>\n&lt;importwatchedstate&gt;true&lt;\/importwatchedstate&gt;<br \/>\n&lt;\/videolibrary&gt;<br \/>\n&lt;\/advancedsettings&gt;<\/p>\n<p>Just change the IP and save the changes, now reboot your xbmc \/ kodi device or restart the software.<\/p>\n<p>Now you should be ready to start adding content with a centralized databse on FreeNAS using MySQL.<\/p>\n<p>Cheers!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the setup I have used on FreeNAS 9.2.1.7 to setup a MySQL server to function for XBMC soon to be KODI. Here we go! Step 1. We want to create a Jail within the FreeNAS webGUI. &#8211; Jails &#8211;&gt; Add Jails The 3 highlighted areas are the only things that need to be [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24,8,25],"tags":[],"_links":{"self":[{"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/posts\/360"}],"collection":[{"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/comments?post=360"}],"version-history":[{"count":8,"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/posts\/360\/revisions"}],"predecessor-version":[{"id":369,"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/posts\/360\/revisions\/369"}],"wp:attachment":[{"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/media?parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/categories?post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bourbonnaisservices.com\/blog\/wp-json\/wp\/v2\/tags?post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}