Share your XBMC 12.0 library on a Synology DS (or other NAS)

As follow up of my previous post on how to share your XBMC library on a Synology NAS with XBMC 11.0 (Eden) I made this guide based on XBMC 12.0 (Frodo). In this post I’ll guide you to the process of moving your XBMC library from your HTPC (or Apple TV or RaspPi) to the Synology DiskStation. So why do you want this? Well a centralized library brings multiple advantages like being able to stop a movie or TV show on one device and continue watching it on another one. Also the watched-state of your media is distributed across your devices. This guide is based on the following software and hardware versions;

I’m using a Synology DiskStation but you can use virtually anything which is capable running a MySQL server instance, for more information about how to install MySQL on your platform visit there website:

XBMC file locations

First take a look at where XBMC place the configuration files, later we need to edit some of them and place some additional files.

  • Windows XP: Documents and Settings\USERNAME\Application Data\XBMC\userdata\
  • Windows Vista/7: Users\USERNAME\AppData\Roaming\XBMC\userdata\
  • Mac OS X: /Users/USERNAME/Library/Application Support/XBMC/userdata/
  • iOS: /private/var/mobile/Library/Preferences/XBMC/userdata/
  • Linux: $HOME/.xbmc/userdata/

From now on when I refer to ‘XBMC userdata folder’ I mean the one listed above.

Create a sources.xml file

One of the configuration files we need to edit is the sources.xml, in this file we will define where the media is located. If you want to use the shared library options later you must keep in mind this location must be accessible from all of these devices. I’m using the default smb video share of my Synology DS with access permissions for everyone so I’m not using any usernames and passwords on my file share. The sources.xml will look like this; sources.xml

Click sources to download my sample file (rename the file extension to xml). Place the sources.xml file on all your XBMC installations in the XBMC userdata folder.

Enable MySQL and phpMyAdmin

Now we will make the preparations to use the MySQL database for you shared XBMC library.

First step is to enable MySQL on the DS (if you don’t use a Synology DS check how you can install MySQL on your device at Open the Synology Disk Station Manager (DSM) and open the ‘Control Panel’ and click ‘Web Services’. Enable MySQL by placing a check at ‘Enable MySQL’ and click ‘Apply’;


Now we need to install the phpMyAdmin package so we can create and edit the databases (If you don’t have a Synology DS please check the phpMyAdmin website to see how to install it on your device). Open the ‘Package Center’ and click the ‘Utilities’-tab. Locate the phpMyAdmin package en click ‘Install’.


Follow the instructions in DSM to complete the installation.

Configure MySQL for XBMC

In my previous guide we manual created the SQL databases for XBMC, with version 12.0 the databases will automatically created by XMBC. The only thing we need to do is create a user account  Open phpMyAdmin from the menu (or browse to http://SYNOLOGYIP/phpMyAdmin), the default login is username root without a password.

Click on the ‘Add user’ link at the ‘Users’ tab.


Fill in the user details, I’m using username ‘xbmc’ with password ‘xbmc’. Click at ‘Global privileges’ on ‘Check All’, by doing this the account is capable to create and alter databases on the MySQL server. In a production setup you probably don’t want to do this but in a home network it’s fine.


That’s it, your database server is ready to serve XBMC.

Connect XBMC to your shared database

OK, the database is up, only thing left is to connect XBMC to it. There is no fancy configuration option in the GUI so we have to edit/create a .xml file again. Don’t worry, it is’t that hard :)

The file we need to create (not default present after the installation of XBMC) is advancedsettings.xml and place it into the XBMC userdata folder. In this file we define the MySQL database connection. It should look like this;


You must replace ***.***.***.*** with the ip-address of your MySQL database server. You can download a sample file here: advancedsettings (rename the file extension to .xml).

That’s all, your centralized library and media files are ready to use.

Thumbnail location

In XBMC 11.0 (Eden) you had to move your thumbnails folder to a shared folder and redirect this folder from your client using pathsubsitution or symlinks (Windows). In XBMC 12.0 this isn’t necessarily, XBMC now uses a local thumbnail cache. The thumbnail location in the database points to the on-line image, when the XBMC client access this file it’s being cached locally to increase performance.

41 thoughts on “Share your XBMC 12.0 library on a Synology DS (or other NAS)

  1. Hoi Rob,

    Ik heb je instructies gevolgd maar krijg het niet voor elkaar om kodi te laten connecten mijn mijn mysql database.

    Krijg allereerst heel veel van onderstaande meldingen (uit kodi log):
    01:00:18 T:4046177184 ERROR: CecLogMessage – Write: write failed !
    01:00:18 T:4113515360 ERROR: Unable to create new database
    01:00:18 T:4113515360 ERROR: Unable to open database: kodi_video99 [2003](Can’t connect to MySQL server on ‘’ (101))

    Hij lijkt ook zelf geen database aan te maken op de MySQL server.
    Heb de kodi user volledige rechten gegegeven maar dit helpt ook niet.

    Wellicht weet jij iets?

  2. Hi Rob, Just installed V13 (Gotham) and now it doesn’t work, say’s “can’t initialise – Exiting” can you help at all??

    Many Thanks

  3. Ik gebruik xbmc/Raspberry om films van mijn NAS (DS214play) af te spelen via bedraad netwerk.
    Dit lukt voor een aantal formaten wel avi sommige iso. Maar niet voor dvd-bestanden (video_ts) en ook niet deze bestanden ingepakte als iso.
    Ik heb mpeg2 en vc1 codec aangeschaft en deze zijn nu enabled.

    Wat zit er nu nog niet goed dat ik nu bepaalde formaten nog steeds niet kan afspelen?

  4. This blog helped me out a ton, thank you! I did run into a couple of snags that I managed to fix, and if it may help anyone else, I’ll post my results:

    (Synology DS212j – Raspberry Pi – OpenElec)

    I ran through the tutorial but after rebooting to get the new advancedsettings.xml file, the Pi wouldn’t boot. After some troubleshooting I realized I had to open up port 3306 within the Synology DSM control panel > firewall. I selected from the list and chose to allow Web station which uses port 3306.

    After that, the Pi booted up just fine and I also noticed that it created the MySQL tables but the library didn’t scan anything into them (logs showed a 0 second scan and couldn’t find videodatabase). Obviously it connected at some point to create the db’s but lost it’s connection somewhere along the line of reboots.

    What I realized is that since I’m using a Wifi dongle, I needed to check the box: System -> OpenElec -> System -> “Wait for network before starting xbmc”

    Once I checked that and rebooted, it found the MySQL table immediately after boot and running a library scan started inserting entries into the MySQL db. Success!

  5. Hi, great guide, thanks for that.

    I am running XBMC OpenElec on a Raspberry PI. Is there a way to update the database on the NAS automatically (without using the Pi) as soon as new movies or TV shows are copied to the shared folder? In my opinion updating the library on Raspberry is too slow and it would be nice, if the database is always up to date.

    Any idea?

  6. Hi, I followed as per your instruction and I can see database created for movies and music. Created the advancedsettings.xml which I believe to be copy to all xbmc running devices.

    Just curious, while on my desktop it scanned and showed all the movies and series, on my macbook, xbmc not showing some of the series and movies. For instance, Supernatural being scanned but no video file listed.

    Will I need to update the library daily or will it be updated automatically across devices? I ask this because my XBMC is not 24/7 running.

  7. I am having a hell of a time getting this to work. I have the DS1513+ and am trying to get XBMC running on a mac mini. No matter how I set it up, XBMC will not be able to connect to the NAS, even though the NAS is mounted wirelessly and I can access the files through the finder.

    Let me try to Explain what I am looking at. When I set up the NAS, I formatted the drive and Named it NASDRIVE. Then it created a folder for applications called web and a folder for files called FILES. In the finder window, you can see under “Shared” the mounted NASDRIVE. Then, under where it says connected as admin and a disconnect button, you see two more mounted sources, FILES and web. I have reserved the IP for the nas…. so to direct XBMC to the media folder, would I type in as the source

    or smb://Media/

    I have tried them all and none work. Suggestions? I would really appreciate a hand here.

  8. Thank you for this, it helped convince me to try the XMBC environment, since it allowed me to one of my Synologies to host the database, which has always been one of my sticking points with some of the other products in this arena.

    Can I “assume” that if/when a XMBC upgrade comes along, then the same process which populates the database will also add new tables?

    On a side note, what are peoples strategies for backing up the Php databases on the Synology to allow for a restore encase of corruption? Is it a simple inclusion of the folders with the php database

  9. Hi Rob,
    Thnx for your great tutorial!
    I’ve got phpmyadmin up and running but my devices (Raspberry, win7, ipad, imac) won’t connect to the server. When i check status log from myadmin i see a lot of failed attempts to connect to the server. It looks like a permissions problem so i’ve walked everything through but I can’t solve my problem. User is ‘xbmc’ same as the password, advancedsettings.xml is created and correctly placed (and written) in userdata.
    Do you got any great ideas??? Thanks in advance!


  10. I have Synology DS207+.
    But I intend to buy another more powerful model.
    I already have a Raspberry Pi but not yet installed XBMC.
    What Synology model do you recommend to use with XBMC, Usenet and magnet links?

    Thanks in advance!

  11. Hoi Rob,
    Nu heb ik XBMC 12.1 “Frodo” en niets werkt meer XBMC wil niet meer samen werken met de Synology en de MySQL!
    Heb jij hier een oplossing voor ?

  12. There is a bug in MySQL on Synology where you can’t properly delete a show or refresh it. The log shows it as:
    “ERROR: SQL: Undefined MySQL error: Code (1436)”

    The solution is to increase the thread_stack value in /etc/my.cnf.
    Increase the thread_stack variable from 128K to 256K.

  13. I’ve followed your guide (and others, but in essence they’re the same) to configure Openelec to use my Synology to store it’s database. With win8 I did get a database in the phpmyadmin overview. But for some reason I can’t get it done now anymore.

    I’ve added the advancedsettings.xml file after removing the local db-files, setting the new sources, still storing the db locally. Then I did a clean setup, same results. No new db is being created on my Syno. Passwords are correct.

    What could I be doing wrong?

  14. Hello Rob,
    Can you be encouraged to develop and provide an automated system, for idiot Snology users, (like me) to install XBMC and all your automatic ‘help’ (SABnzbd, Sickbeard, CouchPotato, & phpMyAdmin)
    Ideally by a simple selection from the ‘Package centre’!
    Thanks in advance,

  15. Ok mischien ben ik wat mierenn**kerig maar typefouten spot ik “Don’t worry, it is’t that hard ” moet toch zijn isn’t 🙂

    Ga vanavond zelf de boel inrichten zodat xbmc zijn database draait vanaf mijn synology. Nu heb ik al redelijk wat films etc geimporteerd in xbmc. Betekent aanpassen van de xbmc database locatie ook dat importeren opnieuw moet? Ik gok van wel omdat de mysql databsase leeg wordt aangemaakt.

    1. Hallo Hein,

      Ik antwoord even in het engels aangezien deze info ook wel handig kan zijn voor andere bezoekers.

      It’s posible to move your traditional XBMC database into the new (empty) MySQL DB. To do this you must export your library from XBMC (before you place the advancedsettings.xml). The continue to setup XBMC to connect to MySQL. After the centralized DB is created you can import your db into MySQL.

      Please note that the previously used file locations must by accessible from all your clients!

      1. Thanks Rob. Not the linux expert here so how does this move also clear the db from my RPi or wil the ‘old’ remain behind on the sd card?

  16. Heintraag had op 05-02-2013 deze vraag gesteld en geen antwoord opgehad, maar ik vroeg me eigenlijk hetzelfde af?

    “Ik heb het nog niet toegepast maar vroeg mij af of dit er dus ook voor zorgt dat de raspberry ontlast wordt doordat nu de database op de synology draait. Zorgt dat voor wat lichtere werklast voor de syno of meer dataverkeer nu ook database inhoud over de lijn heen gaat?”

    Alvast bedankt

  17. Bedankt alvast voor deze geweldige tutorial! Heel handig en werkt prima hier! Bijkomende vraag: is het ook mogelijk om een website te draaien op de Synology die als een viewer dient voor de library? Ik zou namelijk graag mijn dubbele films verwijderen maar daarvoor moet ik dan speciaal de XBMC client voor op starten. Zou handiger zijn moest dit gewoon een webpagina vanop de Synology zijn om te zien wat er in XBMC wordt weergegeven.

  18. Great article! I didnt even thought it was possible to do that on my ds412+. Thanks mate!
    Quick question about your Dreambox800 – your dreambox Live app on ipad still works?

  19. I see you talk about video and music. Two questions: First, are both movies and TV shows covered by the video entry in the files or do you need another entry for TV shows? Secondly, what about photos, do you need entries for those too?

    1. I can verify that when you add this to your advancedsettings.xml file XBMC will create two databases MyMusic32 and MyVideos75 both of which are usually .db files on XBMC.

      I explored the MyVideos75 and found these tables were created tvshow, movie, seasons, episode, a whole bunch of tables were created. all these Tables can be found in the XBMC wiki

      Did not find anything regarding Photos though 🙁

      1. For 2 days now I have been trying to get this to work. I have MySQL set up on my Synology NAS (DS-412+). I created the userid in PHPAdmin and granted full privileges. I created the advanced settings.xml file and put it on my OSX host in Users/Admin/Library/Application Support/XBMC/userdata. I don’t know what I am doing wrong. Every time I open XBMC it uses a local database and not the MySQL I created on my NAS. I used TextEdit to create the file. Is that ok? I put the file directly into the userdata folder. But XBMC won’t use it. What could I be doing wrong? I am very new to XBMC and MySQL but not to computers. Can you help me determine the problem? Thanks …… Rob

        1. Have you deleted the original database files in the Database folder in Application Support/XBMC/userdata. Maybe your XBMC is still loading those database files. If that does not work, the best thing to do would be to Delete your entire userdata folder, start fresh and then add the advancedsettings.xml file and relaunch xbmc, do a full library update by adding your TV Shows/ and Movies/ folders again from smb:// or what ever network protocol you use where your media is stored.

          1. I believe I now have it working although I have not actually added any media. However, in MySQL I now see the databases by XBMC. The reason I haven’t added any media is because I decided to try to use NFS shares (all defined on my Synology NAS) and I can’t get XBMC to connect to the NFS shares. In the XBMC log I get Access Denied even though I think I’ve set up everything correctly.

  20. great site, please keep up the great posts. I currently have a small 2 bay Syno NAS and will soon be getting a 4-bay dual core within the next few days. I actually do something similar to this however I dont make use of a localised mySQL database.

    Do you also run sickbeard, sabnzb and couchpotato on the synology and if so what’s your performance like on the synology running these, i had issues running these on my small arm 2bay nas.

    Also wondering if there is a way to backup the current XBMC library and have it export into mySQL.

    Running my XBMC off a small Intel Atom ASUS mini PC in the front room next to my Synology but would like to export the XBMC library already on the ASUS mini PC hdd onto the Synology.

    Or will i have to start fresh on the database of all things marked as watched, unwatched, current progress etc.

    1. I run sickbeard (piratebay edition) and couchpotate on my ds411slim without performance problems. i have it setup to download the torrents into a blackhole dir where then downloadstation picks them up and starts downloading. Easy 🙂

  21. Ik heb ‘t precies gedaan zoals je zei, Rob, maar ‘t werkt niet. Ik zie in de status van PhPadmin (op de Syno) dat de htpc wel verbinding maakt met de database, maar er gebeurt verder niets. Loopt 3 dagen, 1 MB getransferd (dat is gewoon communicatie-informatie). Ik heb 1900 films, dus het zou wel iets meer moeten zijn dan 1 MB 🙂 In XBMC doet hij overigens ook geen scanning movie library meer, wat ik ook probeer, met die 2 XML’s. Met de stock XML’s doet hij het wel braaf. Heb je enig idee, toevallig?

  22. Goede uitleg. Ik een laptop en sinds kort ook een HTPC met XBMC erop. Alles werkt bij mij naar behoren maar alleen op de HTPC (die ik later in gebruik heb genomen) worden de thumbnails niet automatisch gecached. De film- en serie info wordt keurig vermeld en ook de thumbnails/fanart zijn beschikbaar op de HTPC maar die moet ik voor iedere film/serie handmatig instellen. Op een of andere manier cached de HTPC de thumbnails niet zelf.

    1. Hallo Jack,

      Gebruik je op elke xbmc pc dezelfde versie van xbmc? Dit is een voorwaarde voor het gebruik van een gedeelde database. Ook kan het zijn dat de database geüpgraded moet worden. Het is echter makkelijker om in dat geval de database op nieuw op te bouwen.

  23. Thanks extremely very much, Rob; much appreciated 😀 (Bedanktos, dus :-)). Rob, your last sentence I don’t understand. I was assuming that the thumbs and other data are now stored in the SQL-database on the Synology. Right?

    1. Hi Ton,

      The fanart itself is not stored in the database. The links to the images is stored. On every xbmc installation this file will be locally cached. When al the fanart is stored inside the database it will become very big.

  24. Ik heb het nog niet toegepast maar vroeg mij af of dit er dus ook voor zorgt dat de raspberry ontlast wordt doordat nu de database op de synology draait. Zorgt dat voor wat lichtere werklast voor de syno of meer dataverkeer nu ook database inhoud over de lijn heen gaat?

  25. In XBMC 11.0 (Eden) you had to move your thumbnails folder to a shared folder and redirect this folder from your client using pathsubsitution or symlinks (Windows). In XBMC 12.0 this isn’t necessarily, XBMC now uses a local thumbnail cache and


    Goeie uitleg verder Rob. Dank weer.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.