Comprehensive n00bs Guide on Installing MySQL (and unMENU) to an unRAID Server
#1
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:

Image

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"

Image

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:

Image

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 "root@tower:~#" 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 "root@tower:~#" 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:

Image

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:

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!

Image

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!
Reply
#2
Wow awesome! Im about to set up my unraid server and this will def be of help!! Thanks again... If im on a mac will any of this differ?

Also what r the pros and cons of having a cache drive installed along w the parity? Ot is a cache drive needed? If so when?
Reply
#3
Did you create a swapfile or are you running enough memory in your unraid server to not have one?
Reply
#4
This is great - cracking stuff.

One thing; when I tried this, I couldn't access the unmenu immediately, I had to command ./uu first. Worth adding in?
Reply
#5
*EDIT* *FIXED*
Figured it out! Had to create an autostart.sh routing my ip address to the default gateway.

Please ignore the rest of this..

I am having trouble getting my library to sync with my OpenELEC setup. I've gotten it to sync using Android and a Windows XBMC install but cannot seem to get it to work with the OpenELEC. I'm using the same advancedsettings.xml file for all of them.

I've copied the xml file to the /storage/.xbmc/userdata/ location as instructed. Then I go to Add Video source and choose my location. I've tried to both set the content and not. Refreshing content does nothing. I can't seem to get the Movies or TV Shows so show?

Any ideas?

Thanks in advance!

*edit*
Okay I've found my xbmc.old.log file and found lines where it says It cannot connect to MySQL server.
Reply
#6
Appreciate the guide! I'm having an issue though. I just upgraded unraid to 5.0 and started mysql from scratch and installed it and I created the xbmc user and granted all access like in the guide. And then created the advancedsettings file for xbmc but when I try to scan content it does nothing. I looked at the xbmc log and this the error:
17:21:59 T:4824 ERROR: Unable to create new database
17:21:59 T:4824 ERROR: Unable to open database: MyVideos75 [1044](Access denied for user 'xbmc'@'%' to database 'MyVideos75')

Which doesn't make sense because I created the xbmc user and granted them all access and it shows that user with % in the host column when you do a show hosts command in mysql. So it looks like mysql is preventing xbmc from creating or writing to any of the databases. Also if I try to navigate to the mysql folder in windows explorer I get an access denied error. What would be causing the restriction and do you have any idea how I could get rid it?
Reply
#7
I'm about to build my first unRAID server, and moving all my movies and tv-series to it from my desktop.

One thing this guide doesn't answer is why I would want/need to install MySQL and unMENU on an unRAID server - ie. what do they do, and are they needed for whatever I would be using the unRAID box for?
Reply
#8
Hello. How is this different from XBMC Standalone Library Updater for UnRAID- http://lime-technology.com/forum/index.p...ic=27545.0
Reply
#9
(2013-11-10, 01:02)Yousty Wrote: Appreciate the guide! I'm having an issue though. I just upgraded unraid to 5.0 and started mysql from scratch and installed it and I created the xbmc user and granted all access like in the guide. And then created the advancedsettings file for xbmc but when I try to scan content it does nothing. I looked at the xbmc log and this the error:
17:21:59 T:4824 ERROR: Unable to create new database
17:21:59 T:4824 ERROR: Unable to open database: MyVideos75 [1044](Access denied for user 'xbmc'@'%' to database 'MyVideos75')

Which doesn't make sense because I created the xbmc user and granted them all access and it shows that user with % in the host column when you do a show hosts command in mysql. So it looks like mysql is preventing xbmc from creating or writing to any of the databases. Also if I try to navigate to the mysql folder in windows explorer I get an access denied error. What would be causing the restriction and do you have any idea how I could get rid it?

Getting this same exact error now. Just wondering how you got it solved?
Reply
#10
(2014-01-09, 19:57)Eklar Wrote: I'm about to build my first unRAID server, and moving all my movies and tv-series to it from my desktop.

One thing this guide doesn't answer is why I would want/need to install MySQL and unMENU on an unRAID server - ie. what do they do, and are they needed for whatever I would be using the unRAID box for?
My guess is that this is used to get real-time information on what's stored on the hard drives? Where as using xbmc/kodi as usual and you add a file to your unRAID folder, then xbmc/kodi won't know about it unless you do a Library update either manually or if you have it set to do it at startup and you reboot. But I don't know how Kodi would do a banner and description download every time you add something to the directory.

The issue I could see for me would be every time I open the Video library it would access my unRAID and wake the hard drive from sleep that has the database file stored on it. I suppose I could install a solid state drive just for the database file, but who wants to do that. I like having all my hard drives in sleep mode while not in use. Anytime I try to play a movie/tv show it only wakes up the hard drive that it's stored on. XBMC/Kodi w/unRAID standard config works perfectly fine for me.
Reply
#11
I'm about to use mySQL in unRAID, but since this guide is pretty old, I wonder if it's still up to date?
unRAID is now on version 6.4.0 and mySQL is installed as a docker, By: linuxserver/mysql:latest

I need some info about how to set it up for Kodi, but I don't understand where in this guide I should start if I just installed it as a docker.

Thanks for help.

/Söder
Vero 4K with unRAID server and mysql (mariadb)
Reply

Logout Mark Read Team Forum Stats Members Help
Comprehensive n00bs Guide on Installing MySQL (and unMENU) to an unRAID Server0