2013-09-01, 21:29
I posted this over at the Lime Tech Forums since it was specifically for an unRAID OS but thought it could be of use to anyone on the forums here. Here is the link to the wiki on XBMC in regards to this topic, so if you're doing this on a different OS you could certainly cross reference this post and that wiki page. Everything else is applicable besides setting up MySQL. If you're not doing it on unRAID, refer to this link and then start at step 5.
http://wiki.xbmc.org/index.php?title=HOW...ab=Windows
I'll preface this by saying I myself am a newbie to all of this, which I think is what qualifies me to make a guide for other people in a smiliar position. There are many excellent tutorials available online, but I feel like we're missing an all-in-one tutorial for someone that doesn't have an extensive background in unRAID or other NAS devices.
Also, things have changed since the last one was written a few years back. Many people now run on Frodo 12.2, so all instructions given below are assuming this is the version of XBMC you're running. If that's not the case, well, to be honest, I have no idea if this will work properly.
I also want to make sure I thank a few people, especially mobias1313 and vl1969. Both of these guys let me rattle on for quite some time and ask the same questions over and over again until I was able to soak up the necessary knowledge to do what I was hoping to do. They spent plenty of their free time helping me and asked for nothing in return. By doing this guide, I hope I'm able to give back a little to the community that has helped me get my fun little server running. If there are errors, they are completely on me and not anyone else. Hopefully we can make some minor revisions and get this as the new and updated thread on MySQL for unRAID.
With that said, I bring to you:
The Comprehensive n00bs Guide on Installing MySQL (and unMENU) to an unRAID Server
1. Assumptions
The only assumption we will make is that you already have some sort of network attached storage set up that is running unRAID. If that's not the case, I doubt you'd be reading this thread, but if for some reason you have nothing, here is an interesting little youtube video to watch about building an unRAID server:
http://www.youtube.com/watch?v=DA9AKLOVOKk
2. Installing unMENU
The first thing you need to make sure is that you have unMenu installed. unMENU is a web application that gives you additional options when viewing unRAID through a web browser. To access unRAID from a computer on your network, you will type the IP address of your unRAID server into your web browser as shown below:

The IP address of my unRAID server is 192.168.1.3. After installing unMENU, you can then add :8080 after the IP address. This will bring you to a more comprehensive and detailed screen which is what we call "unMENU".
The important thing we're looking for is an additional tab called Pkg Manager. We will get to this later. Installing unMENU is easy, but many of the online directions assume you have certain things done already that you may not.
First, download unMENU here:
https://code.google.com/p/unraid-unmenu/downloads/list
This is a zip file with one total file. Unzip the file somewhere to your desktop and don't forget where you put it. Now open up windows explorer. Click on network. The name of your unRAID server should be listed. Click it. Double click on the flash folder. Add a new folder named "unmenu"

Take the file that you placed on your desktop that was unzipped and place it in the unMENU folder.
Next is where the directions get shady if you're new to this. It's very easy, but explanations assume you know the basics. I'll assume you know very little. You now need to be able to access the command prompt for your unRAID server. I find the easiest way to do this is to install a program called Putty.
http://www.chiark.greenend.org.uk/~sgtat...nload.html
After installing putty, you will have a configuration screen similar to what is as shown below:

In the host name field type in the IP address of the unRAID server. Under port, type 23. Make sure you select "Telnet". Click open. You will then be brought to your typical black and white command prompt screen. Type in "root" when prompted for a password. Next, we will follow instructions from Joe. L's thread:
[quote author=Joe L. link=topic=5568.msg51814#msg51814 date=1268082458]
type:
cd /boot/unmenu
unmenu_install -i -d /boot/unmenu
[/quote]
When typing the above command, make sure it says "[email protected]:~#" before typing the command. Tower is the name of your unraid server so if you changed it then it will be different. If it says something after the colon with a slash, like /config (not sure why this would happen, but I guess it could) use the command "cd.." to move yourself up a directiory. Continue to type "cd.." until your screen says "[email protected]:~#" Then type the above commands.
After a few seconds, unMENU is installed. We can temporarily exit putty and return to our webrowser where we can type in the IP address of our server followed by :8080. If all was done right, we will see the following screen:

3. Installing MySQL
At this point, the tutorial is pretty straight forward that was created by hernandito back in 2011. I will quote up until there have been modifications:
[quote author=hernandito link=topic=11473.msg109149#msg109149 date=1299174088]
Step 2 - Installing and configuring MySQL
This is derived mostly from the Lifehacker guide at http://lifehacker.com/#!5634515/how-to-s...-the-house but modified to implement in unRAID.
To install MySQL go into unMenu and click on Pkg Manager. Scroll down the list and click on the button for "MySQL Database Server". Download the package. Click on "Edit Configuration Variables".
Enter the Hostname of your unRAID server - mine is the default "Tower" (without quotes)
Disk Label: is where you want MySQL to install its files - I chose "disk1"
MySQL Password: enter a password of your choice. This is not the same password that you use to log in to unRAID. Remember the password.
First Database: accept the default
Database User: accept "root" default
Database User Password: enter another password of your choice it is likely you will never have to enter this password.
Custom Parameters: leave blank.
Click on "Save Values" and then click on "Restart Using New values". You also want to enable to re-install on reboot.
[/quote]
4. Configuring MySQL
Below is a continuation from the same thread mentioned above. When mentioning a telnet session, use Putty as done before:
Now every step here is the same as the Lifehacker guide. At the terminal enter:
You should get a Query OK message
At this point, there are some places to deviate from the original instructions.
As shown in the lifehacker post.....
http://lifehacker.com/#!5634515/how-to-s...-the-house
...it is very important to also type the following command:
This gives the user, xbmc, the proper access credentials.
To check to see if you properly created the user, type the following while still in the MySQL command prompt:
You should get results like shown on this image:

Unlike the tutorial mentioned before, we will not create any tables for the database. We will allow XBMC to populate these fields when XBMC opens for the first time after installing MySQL.
5. Advancedsettings.xml File
We will now head to the final step which is creating the advancedsettings.xml file which is the file that tells XBMC how to access the MySQL database on your unraid server.
When I added MySQL to the unRAID server, I started my library from scratch. It is currently very small, so I had no need to import/export my library. Because I did not do this, I cannot advise how to do so. My advice is to start the library from scratch and let it repopulate. As long as you're willing to clear your library and allow XBMC to repopulate and scrape new images, then proceed to step #2 on the following web page:
http://wiki.xbmc.org/index.php?title=HOW...ng_up_XBMC
To summarize, you will open up notepad and copy and paste the following:
<advancedsettings>
<videodatabase>
<type>mysql</type>
<host>***.***.***.***</host>
<port>3306</port>
<user>xbmc</user>
<pass>xbmc</pass>
</videodatabase>
<musicdatabase>
<type>mysql</type>
<host>***.***.***.***</host>
<port>3306</port>
<user>xbmc</user>
<pass>xbmc</pass>
</musicdatabase>
<videolibrary>
<importwatchedstate>true</importwatchedstate>
</videolibrary>
</advancedsettings>
Where the stars are, you will replace the stars with the IP Address of your unRAID server. Save this file as 'advancedsettings.xml'. This saved file needs to be placed on any and ALL devices which use XBMC that you would like to access the MySQL database on your unRAID server . It needs to be placed into the user data folder of any device wishing to sync to this database. Below is a link showing where each folder is depending on which operating system you're running on that device:
http://wiki.xbmc.org/index.php?title=Userdata_folder
For windows, copy and paste %appdata%\XBMC\userdata\ into windows explorer address bar and it will take you directly to the user data folder. Place the advanced settings file in this folder and you will be good to go!

You should now be able to open up XBMC, click on videos, click on files, click add videos, click browse, scroll to "Windows network (SMB)", choose the name of your unraid server, and then select the drives where your movie files are located.
As long as you've put the advancedsettings.xml file onto all devices that will be reading off of this database that now exists on your unRAID server, each device should have each library and all information associated with the library synced.
Hope this helps! If there are any questions I will do my best to assist, but I'm sure most others will be of more assistance. No question is a dumb question. Don't forget, we all start somewhere!
http://wiki.xbmc.org/index.php?title=HOW...ab=Windows
I'll preface this by saying I myself am a newbie to all of this, which I think is what qualifies me to make a guide for other people in a smiliar position. There are many excellent tutorials available online, but I feel like we're missing an all-in-one tutorial for someone that doesn't have an extensive background in unRAID or other NAS devices.
Also, things have changed since the last one was written a few years back. Many people now run on Frodo 12.2, so all instructions given below are assuming this is the version of XBMC you're running. If that's not the case, well, to be honest, I have no idea if this will work properly.
I also want to make sure I thank a few people, especially mobias1313 and vl1969. Both of these guys let me rattle on for quite some time and ask the same questions over and over again until I was able to soak up the necessary knowledge to do what I was hoping to do. They spent plenty of their free time helping me and asked for nothing in return. By doing this guide, I hope I'm able to give back a little to the community that has helped me get my fun little server running. If there are errors, they are completely on me and not anyone else. Hopefully we can make some minor revisions and get this as the new and updated thread on MySQL for unRAID.
With that said, I bring to you:
The Comprehensive n00bs Guide on Installing MySQL (and unMENU) to an unRAID Server
1. Assumptions
The only assumption we will make is that you already have some sort of network attached storage set up that is running unRAID. If that's not the case, I doubt you'd be reading this thread, but if for some reason you have nothing, here is an interesting little youtube video to watch about building an unRAID server:
http://www.youtube.com/watch?v=DA9AKLOVOKk
2. Installing unMENU
The first thing you need to make sure is that you have unMenu installed. unMENU is a web application that gives you additional options when viewing unRAID through a web browser. To access unRAID from a computer on your network, you will type the IP address of your unRAID server into your web browser as shown below:

The IP address of my unRAID server is 192.168.1.3. After installing unMENU, you can then add :8080 after the IP address. This will bring you to a more comprehensive and detailed screen which is what we call "unMENU".
The important thing we're looking for is an additional tab called Pkg Manager. We will get to this later. Installing unMENU is easy, but many of the online directions assume you have certain things done already that you may not.
First, download unMENU here:
https://code.google.com/p/unraid-unmenu/downloads/list
This is a zip file with one total file. Unzip the file somewhere to your desktop and don't forget where you put it. Now open up windows explorer. Click on network. The name of your unRAID server should be listed. Click it. Double click on the flash folder. Add a new folder named "unmenu"

Take the file that you placed on your desktop that was unzipped and place it in the unMENU folder.
Next is where the directions get shady if you're new to this. It's very easy, but explanations assume you know the basics. I'll assume you know very little. You now need to be able to access the command prompt for your unRAID server. I find the easiest way to do this is to install a program called Putty.
http://www.chiark.greenend.org.uk/~sgtat...nload.html
After installing putty, you will have a configuration screen similar to what is as shown below:

In the host name field type in the IP address of the unRAID server. Under port, type 23. Make sure you select "Telnet". Click open. You will then be brought to your typical black and white command prompt screen. Type in "root" when prompted for a password. Next, we will follow instructions from Joe. L's thread:
[quote author=Joe L. link=topic=5568.msg51814#msg51814 date=1268082458]
type:
cd /boot/unmenu
unmenu_install -i -d /boot/unmenu
[/quote]
When typing the above command, make sure it says "[email protected]:~#" before typing the command. Tower is the name of your unraid server so if you changed it then it will be different. If it says something after the colon with a slash, like /config (not sure why this would happen, but I guess it could) use the command "cd.." to move yourself up a directiory. Continue to type "cd.." until your screen says "[email protected]:~#" Then type the above commands.
After a few seconds, unMENU is installed. We can temporarily exit putty and return to our webrowser where we can type in the IP address of our server followed by :8080. If all was done right, we will see the following screen:

3. Installing MySQL
At this point, the tutorial is pretty straight forward that was created by hernandito back in 2011. I will quote up until there have been modifications:
[quote author=hernandito link=topic=11473.msg109149#msg109149 date=1299174088]
Step 2 - Installing and configuring MySQL
This is derived mostly from the Lifehacker guide at http://lifehacker.com/#!5634515/how-to-s...-the-house but modified to implement in unRAID.
To install MySQL go into unMenu and click on Pkg Manager. Scroll down the list and click on the button for "MySQL Database Server". Download the package. Click on "Edit Configuration Variables".
Enter the Hostname of your unRAID server - mine is the default "Tower" (without quotes)
Disk Label: is where you want MySQL to install its files - I chose "disk1"
MySQL Password: enter a password of your choice. This is not the same password that you use to log in to unRAID. Remember the password.
First Database: accept the default
Database User: accept "root" default
Database User Password: enter another password of your choice it is likely you will never have to enter this password.
Custom Parameters: leave blank.
Click on "Save Values" and then click on "Restart Using New values". You also want to enable to re-install on reboot.
[/quote]
4. Configuring MySQL
Below is a continuation from the same thread mentioned above. When mentioning a telnet session, use Putty as done before:
Quote:Open up a telnet session into your unRAID server and at the command prompt enter:
Code:mysql -u root -p
Type the MySQL Password you entered above.
Now every step here is the same as the Lifehacker guide. At the terminal enter:
Code:
CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';
You should get a Query OK message
At this point, there are some places to deviate from the original instructions.
As shown in the lifehacker post.....
http://lifehacker.com/#!5634515/how-to-s...-the-house
...it is very important to also type the following command:
Code:
GRANT ALL ON *.* TO 'xbmc';
This gives the user, xbmc, the proper access credentials.
To check to see if you properly created the user, type the following while still in the MySQL command prompt:
Code:
SELECT host,user from mysql.user;
You should get results like shown on this image:

Unlike the tutorial mentioned before, we will not create any tables for the database. We will allow XBMC to populate these fields when XBMC opens for the first time after installing MySQL.
5. Advancedsettings.xml File
We will now head to the final step which is creating the advancedsettings.xml file which is the file that tells XBMC how to access the MySQL database on your unraid server.
When I added MySQL to the unRAID server, I started my library from scratch. It is currently very small, so I had no need to import/export my library. Because I did not do this, I cannot advise how to do so. My advice is to start the library from scratch and let it repopulate. As long as you're willing to clear your library and allow XBMC to repopulate and scrape new images, then proceed to step #2 on the following web page:
http://wiki.xbmc.org/index.php?title=HOW...ng_up_XBMC
To summarize, you will open up notepad and copy and paste the following:
<advancedsettings>
<videodatabase>
<type>mysql</type>
<host>***.***.***.***</host>
<port>3306</port>
<user>xbmc</user>
<pass>xbmc</pass>
</videodatabase>
<musicdatabase>
<type>mysql</type>
<host>***.***.***.***</host>
<port>3306</port>
<user>xbmc</user>
<pass>xbmc</pass>
</musicdatabase>
<videolibrary>
<importwatchedstate>true</importwatchedstate>
</videolibrary>
</advancedsettings>
Where the stars are, you will replace the stars with the IP Address of your unRAID server. Save this file as 'advancedsettings.xml'. This saved file needs to be placed on any and ALL devices which use XBMC that you would like to access the MySQL database on your unRAID server . It needs to be placed into the user data folder of any device wishing to sync to this database. Below is a link showing where each folder is depending on which operating system you're running on that device:
http://wiki.xbmc.org/index.php?title=Userdata_folder
For windows, copy and paste %appdata%\XBMC\userdata\ into windows explorer address bar and it will take you directly to the user data folder. Place the advanced settings file in this folder and you will be good to go!

You should now be able to open up XBMC, click on videos, click on files, click add videos, click browse, scroll to "Windows network (SMB)", choose the name of your unraid server, and then select the drives where your movie files are located.
As long as you've put the advancedsettings.xml file onto all devices that will be reading off of this database that now exists on your unRAID server, each device should have each library and all information associated with the library synced.
Hope this helps! If there are any questions I will do my best to assist, but I'm sure most others will be of more assistance. No question is a dumb question. Don't forget, we all start somewhere!