<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://kodi.wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rm-r</id>
	<title>Official Kodi Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://kodi.wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rm-r"/>
	<link rel="alternate" type="text/html" href="https://kodi.wiki/view/Special:Contributions/Rm-r"/>
	<updated>2026-06-05T06:40:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66851</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66851"/>
		<updated>2013-12-17T02:56:20Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Install mysql */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=Other NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
make a note of the jail IP address shown - you will need this to put in the advancedsettings.xml file on the XBMC machine later&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg install mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg install nano&amp;lt;/code&amp;gt;&lt;br /&gt;
**(nano is a text editor you will need shortly)&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
insert the line below into the rc.conf file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will secure you mysql instance - it will prompt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that&#039;s it - proceed to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66832</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66832"/>
		<updated>2013-12-16T00:01:01Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Install mysql */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=Other NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
make a note of the jail IP address shown - you will need this to put in the advancedsettings.xml file on the XBMC machine later&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
**(nano is a text editor you will need shortly)&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
insert the line below into the rc.conf file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will secure you mysql instance - it will prompt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that&#039;s it - proceed to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66831</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66831"/>
		<updated>2013-12-15T23:50:41Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Configure mysql ready for xbmc to use */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=Other NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
make a note of the jail IP address shown - you will need this to put in the advancedsettings.xml file on the XBMC machine later&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
**(nano is a text editor you will need shortly)&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
insert the line below into the rc.conf file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will prompt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that&#039;s it - proceed to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66830</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66830"/>
		<updated>2013-12-15T23:49:56Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and freeBSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=Other NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
make a note of the jail IP address shown - you will need this to put in the advancedsettings.xml file on the XBMC machine later&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
**(nano is a text editor you will need shortly)&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
insert the line below into the rc.conf file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will prompt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
thats it - proced to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66767</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66767"/>
		<updated>2013-12-14T06:27:20Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* NAS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=synology NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
**(nano is a text editor you will need shortly)&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
insert the line below into the rc.conf file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will prompt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
thats it - proced to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66766</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66766"/>
		<updated>2013-12-14T06:21:20Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Install mysql */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
**(nano is a text editor you will need shortly)&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
insert the line below into the rc.conf file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will prompt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
thats it - proced to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66765</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66765"/>
		<updated>2013-12-14T06:20:58Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Install mysql */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
**(nano is a text editor you will need shortly)&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
insert the line below into the rc.conf file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will propt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
thats it - proced to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66764</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66764"/>
		<updated>2013-12-14T06:20:00Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Install mysql */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
**(nano is a text editor you will need shortly)&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will propt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
thats it - proced to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66763</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66763"/>
		<updated>2013-12-14T06:18:37Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and freeBSD=&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt; nano is a text editor you will need shortly&lt;br /&gt;
&lt;br /&gt;
We now need to enable mysql in rc.conf&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for keystrokes info)&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optional step below - this is an automated script that will propt you for answers to questions. Its up to you if you do this.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
type in&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql administration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
thats it - proced to the next step below and configure XBMC to use your FreeNAS hosted XBMC MYSQL database - I love mine!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66762</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66762"/>
		<updated>2013-12-14T06:01:05Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Prepare the jail */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for info&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66761</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66761"/>
		<updated>2013-12-14T05:59:46Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* About FreeNAS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for info&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66760</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66760"/>
		<updated>2013-12-14T05:56:19Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* How to */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) &lt;br /&gt;
**(easiest) click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for info&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configure mysql ready for xbmc to use ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You are now in mysql&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66759</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66759"/>
		<updated>2013-12-14T05:54:06Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* How to */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*ssh into FreeNAS&lt;br /&gt;
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for info&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
You are now in mysql&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66758</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66758"/>
		<updated>2013-12-14T05:52:33Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Prepare the jail */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS (if you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for info&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
You are now in mysql&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66755</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66755"/>
		<updated>2013-12-14T00:51:20Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Install mysql */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for info&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
You are now in mysql&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66754</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66754"/>
		<updated>2013-12-14T00:50:31Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* Install mysql */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;nano /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
save the file and exit (see bottom of nano edit page for info&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;you are now in mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66753</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66753"/>
		<updated>2013-12-14T00:48:05Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
=== Make a jail ===&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
=== Prepare the jail ===&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
=== Install mysql ===&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;vi /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;you are now in mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66752</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66752"/>
		<updated>2013-12-14T00:46:46Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
== About FreeNAS ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
== How to ==&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;vi /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;you are now in mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66751</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66751"/>
		<updated>2013-12-14T00:45:35Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
== Currently DRAFT and incomplete! ==&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it uses ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;vi /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;you are now in mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66750</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66750"/>
		<updated>2013-12-14T00:39:53Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
Currently DRAFT and incomplete!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it utilises ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;vi /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;you are now in mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66749</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66749"/>
		<updated>2013-12-14T00:38:59Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
Currently DRAFT and incomplete!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it utilises ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#*Take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#*replace n with the number of the jail you just created&lt;br /&gt;
&lt;br /&gt;
#*You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;vi /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;you are now in mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66748</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66748"/>
		<updated>2013-12-14T00:35:37Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
Currently DRAFT and incomplete!&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it utilises ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pkg_add -r nano&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;vi /etc/rc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add in to the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_enable=&amp;quot;YES&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;service mysql-server start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;you are now in mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66747</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66747"/>
		<updated>2013-12-14T00:18:54Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
Currently DRAFT and incomplete!&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it utilises ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
take note of the JID of the jail you created&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
pkg_add -r mysql55-client&lt;br /&gt;
&lt;br /&gt;
vi /etc/rc.conf&lt;br /&gt;
add in to the file&lt;br /&gt;
mysql_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
&lt;br /&gt;
service mysql-server start&lt;br /&gt;
mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
#in mysql&lt;br /&gt;
CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&lt;br /&gt;
GRANT ALL ON *.* TO &#039;xbmc&#039;;&lt;br /&gt;
quit;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66746</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66746"/>
		<updated>2013-12-14T00:17:45Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: /* FreeNAS and BSD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
Currently DRAFT and incomplete!&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it utilises ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS (use putty or click the &amp;quot;shell&amp;quot; button in the left of the FreeNAS webui&lt;br /&gt;
&lt;br /&gt;
type the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;jls&amp;lt;/code&amp;gt;&lt;br /&gt;
take note of the JID of the jail you created&lt;br /&gt;
&amp;lt;code&amp;gt;jexec n csh&amp;lt;/code&amp;gt;&lt;br /&gt;
replace n with the number of the jail you just created&lt;br /&gt;
You are now inside your jail&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pkg_add -r mysql55-server&amp;lt;/code&amp;gt;&lt;br /&gt;
pkg_add -r mysql55-client&lt;br /&gt;
&lt;br /&gt;
vi /etc/rc.conf&lt;br /&gt;
add in to the file&lt;br /&gt;
mysql_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
&lt;br /&gt;
service mysql-server start&lt;br /&gt;
mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
#in mysql&lt;br /&gt;
CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&lt;br /&gt;
GRANT ALL ON *.* TO &#039;xbmc&#039;;&lt;br /&gt;
quit;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
	<entry>
		<id>https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66745</id>
		<title>MySQL/Setting up MySQL</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&amp;diff=66745"/>
		<updated>2013-12-13T21:32:43Z</updated>

		<summary type="html">&lt;p&gt;Rm-r: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Frodo updated}}{{:HOW-TO:Sync multiple libraries/Contents}}&lt;br /&gt;
You&#039;ll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;{{notice|Users are reporting issues with &#039;&#039;&#039;MySQL 5.6&#039;&#039;&#039;. Use &#039;&#039;&#039;MySQL 5.5&#039;&#039;&#039; instead.}}&amp;lt;/big&amp;gt;&lt;br /&gt;
MySQL can be installed on just about every major OS:&lt;br /&gt;
&lt;br /&gt;
=Ubuntu Linux=&lt;br /&gt;
&#039;&#039;&#039;Ubuntu Linux:&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo apt-get install mysql-server&amp;lt;/code&amp;gt; &#039;&#039;(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and change the bind-address directive to the server&#039;s IP address:&lt;br /&gt;
##from: &amp;lt;code&amp;gt;bind-address = 127.0.0.1&amp;lt;/code&amp;gt; &lt;br /&gt;
##to: &amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use &amp;lt;code&amp;gt;bind-address = 0.0.0.0&amp;lt;/code&amp;gt;&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo restart mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arch Linux=&lt;br /&gt;
&#039;&#039;&#039;Arch Linux:&#039;&#039;&#039;&lt;br /&gt;
*Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, XBMC will require no modifications to work with it.&lt;br /&gt;
#Install MariaDB: &amp;lt;code&amp;gt;$ sudo pacman -S mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
#Start the service: &amp;lt;code&amp;gt;$ sudo systemctl start mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#To have it automatically launch at startup: &amp;lt;code&amp;gt;$ sudo systemctl enable mysqld&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password: &amp;lt;code&amp;gt;$ /usr/bin/mysql_secure_installation&amp;lt;/code&amp;gt; &#039;&#039;This will also clean up the demo database.&#039;&#039;&lt;br /&gt;
#Get into the MariaDB command line utility: &amp;lt;code&amp;gt;$ mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=RedHat based Linux=&lt;br /&gt;
&#039;&#039;&#039;RedHat based Linux (RHEL, CentOS, Fedora):&#039;&#039;&#039;&lt;br /&gt;
#&amp;lt;code&amp;gt;$sudo yum install mysql-server&amp;lt;/code&amp;gt;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#To configure MySQL to listen for connections only from network hosts, edit &#039;&#039;/etc/mysql/my.cnf&#039;&#039; and add the bind-address directive to the server&#039;s IP address:&amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;bind-address = 192.168.0.5&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Note: Replace 192.168.0.5 with the appropriate address.&lt;br /&gt;
#*Note: Alternatively you can leave this file as is to allow local and remote access.&lt;br /&gt;
#Restart your MySQL server. &amp;lt;code&amp;gt;$sudo /sbin/service mysqld restart&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Recommended - Set your MySQL root password with &amp;lt;code&amp;gt;/usr/bin/mysqladmin -u root password &#039;new-password&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
#Get into the MySQL command line utility: &amp;lt;code&amp;gt;$mysql -u root -p&amp;lt;/code&amp;gt;&lt;br /&gt;
#*Enter your MySQL root password as set above, or just press enter if you didn&#039;t set one to log in with a blank password&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool with &amp;lt;code&amp;gt;\q&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Mac OS X=&lt;br /&gt;
&#039;&#039;&#039;Mac OS X:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#In Mac OS X, go to System Preferences -&amp;gt; MySQL, and click on “Start MySQL Server”.  You’ll also want to tick to enable the “Automatically … on Startup” option.&lt;br /&gt;
#Now to set up the &amp;quot;xbmc&amp;quot; user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo /usr/local/mysql/bin/mysql&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
#Remain in Terminal.app. Now you&#039;ll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /usr/local/mysql/support-files/&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo cp my-huge.cnf /etc/my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.&lt;br /&gt;
##&amp;lt;code&amp;gt;cd /etc&amp;lt;/code&amp;gt;&lt;br /&gt;
##&amp;lt;code&amp;gt;sudo nano my.cnf&amp;lt;/code&amp;gt;&lt;br /&gt;
##:&#039;&#039;This opens a file in a command line text editor&#039;&#039;&lt;br /&gt;
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:&lt;br /&gt;
##:&amp;lt;code&amp;gt;bind-address = ***.***.***.***&amp;lt;/code&amp;gt;&lt;br /&gt;
##Save and exit from the command line text editor&lt;br /&gt;
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631&lt;br /&gt;
&lt;br /&gt;
=Windows=&lt;br /&gt;
&#039;&#039;&#039;Windows:&#039;&#039;&#039;&lt;br /&gt;
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/&lt;br /&gt;
#Select &#039;&#039;Standard configuration&#039;&#039;&lt;br /&gt;
#Create a password when asked&lt;br /&gt;
#Select that you want the database to have network access when prompted during installation.&lt;br /&gt;
#Open the &amp;quot;MySQL Command Line Client&amp;quot; from the MySQL start menu&lt;br /&gt;
#Enter the following commands:&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
##Type in: &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;;&amp;lt;/code&amp;gt; and press return&lt;br /&gt;
#Close out the command line tool&lt;br /&gt;
#In &#039;&#039;&#039;Windows 7&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot; &lt;br /&gt;
##Go to control panel and open windows firewall&lt;br /&gt;
##Click on advanced settings&lt;br /&gt;
##Click on Inbound Rules, then new rule&lt;br /&gt;
##Chose the port option, click next&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
##Make sure Allow the connection is checked then click next&lt;br /&gt;
##Name it MYSQL Inbound(or whatever you want) then click finish&lt;br /&gt;
##Use these same steps to set up the Outbound exception then name it MYSQL Outbound(or whatever you want) then you&#039;re finished.&lt;br /&gt;
#:You may or may not have to set up both in and outbound, someone with more knowledge please edit this if you know.&lt;br /&gt;
#In &#039;&#039;&#039;Windows XP&#039;&#039;&#039;, you may need to make an exception in the &amp;quot;Windows Firewall&amp;quot;&lt;br /&gt;
##Open Control Panel and Set to &#039;Classic View&#039;&lt;br /&gt;
##Double Click on Windows Firewall&lt;br /&gt;
##Click on Exception--&amp;gt;Add Port&lt;br /&gt;
##Name It MySQL XBMC or whatever you want&lt;br /&gt;
##Then type in the port number you set mysql to use(Default is 3306)&lt;br /&gt;
#:{{Note|You must do this twice:Once for UDP and once for TCP}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}&amp;lt;br/&amp;gt;&lt;br /&gt;
If this occurs to you, try amending Step 2 above to read &amp;lt;code&amp;gt;GRANT ALL ON *.* TO &#039;xbmc&#039;@&#039;xxx.xxx.xxx.%&#039;;&amp;lt;/code&amp;gt; where xxx.xxx.xxx is the first three quadrants of your home network&#039;s IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.&lt;br /&gt;
&lt;br /&gt;
=NAS=&lt;br /&gt;
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed:&lt;br /&gt;
&lt;br /&gt;
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page.&lt;br /&gt;
*[http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC]&lt;br /&gt;
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo&lt;br /&gt;
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID&lt;br /&gt;
&lt;br /&gt;
=FreeNAS and BSD=&lt;br /&gt;
&lt;br /&gt;
Currently DRAFT and incomplete!&lt;br /&gt;
&lt;br /&gt;
http://www.freenas.org/&lt;br /&gt;
&lt;br /&gt;
FreeNas is a FreeBSD based NAS system that can be run on most hardware - it utilises ZFS for disk and file management.&lt;br /&gt;
99% of tasks can be done via the web interface.&lt;br /&gt;
&lt;br /&gt;
Example below is based on FreeNAS 9.1.1&lt;br /&gt;
&lt;br /&gt;
create a Jail via the FreeNAS webui (example to follow)&lt;br /&gt;
&lt;br /&gt;
ssh into FreeNAS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;jexec 1 csh&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in jail&lt;br /&gt;
pkg_add -r mysql55-server&lt;br /&gt;
pkg_add -r mysql55-client&lt;br /&gt;
&lt;br /&gt;
vi /etc/rc.conf&lt;br /&gt;
add in to the file&lt;br /&gt;
mysql_enable=&amp;quot;YES&amp;quot;&lt;br /&gt;
&lt;br /&gt;
service mysql-server start&lt;br /&gt;
mysql_secure_installation&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p&lt;br /&gt;
#in mysql&lt;br /&gt;
CREATE USER &#039;xbmc&#039; IDENTIFIED BY &#039;xbmc&#039;;&lt;br /&gt;
GRANT ALL ON *.* TO &#039;xbmc&#039;;&lt;br /&gt;
quit;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;headertabs /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If your library loads slowly with MySQL then you may wish to check out &#039;&#039;&#039;[[HOW-TO:Sync multiple libraries/Advanced notes#MySQL speed-up tweaks|these MySQL speed-up tweaks]]&#039;&#039;&#039;.&lt;br /&gt;
{{Divbox|green||&#039;&#039;&#039;Optional:&#039;&#039;&#039; For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you&#039;re worried about your internal network being exposed and wanting to lock things down more, etc. If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyMusic%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
#&amp;lt;code&amp;gt;GRANT ALL ON `MyVideos%`.* TO &#039;xbmc&#039;@&#039;%&#039; IDENTIFIED BY &#039;xbmc&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
Note: these grants do not appear to give the xbmc user permissions to create required TRIGGERs.  So either figure out how to do an additional limited grant to create TRIGGERs or use the broader grant *.* statement above. }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Next|[[HOW-TO:Share libraries using MySQL/Setting up XBMC|Setting up XBMC]]}}&lt;/div&gt;</summary>
		<author><name>Rm-r</name></author>
	</entry>
</feed>