If you are using multiple instances of XBMC throughout your house one thing you’ll definitely want to consider is setting up a shared MySQL database that can be used to retain data about the media you have. A good example of this is saving the status of where you left off in a video. If all of your XBMC instances don’t share a centralized data system you won’t be able to stop a video in one room and pick up where you left off in another. A MySQL database gives each XBMC a way to share that data.


You can even step beyond just sharing a database and share other files as well. This can include thumbnails of the media you have in your library, add-on configurations, media sources, and more. When all of this is set up it will almost be like having a centralized XBMC server.

Setup a Shared MySQL Database:

Xbmc sql

On your centralized server you’ll want to install and configure MySQL which will vary based on OS. Here is a general overview of what you need to do:

  1. Install and start MySQL (note that there is a link to skip registering for an account on the download page)
  2. Open the Terminal (on a Mac) or the MySQL Command Line Client (on Windows) and run the following commands:
    1. CREATE USER ‘xbmc’ IDENTIFIED BY ‘xbmc’;
    2. CREATE database xbmc_video; (This is no longer needed)
    3. CREATE database xbmc_music; (This is no longer needed)
    4. GRANT ALL ON *.* TO ‘xbmc’;

Now we need to configure the XBMC clients to connect to the new MySQL database. On each of the clients navigate to the following directory:

  • Mac: ~/Library/Application Support/XBMC/userdata/
  • Windows: %appdata%\XBMC\userdata\

If you don’t see a file named advancedsettings.xml go ahead and create it, but if it does exist just open it up. You’ll need to add the following lines to it:

<videodatabase>
<host>192.168.1.10</host>
<name>xbmc_video</name>
<port>3306</port>
<user>xbmc</user>
<pass>xbmc</pass>
</videodatabase>

<musicdatabase>
<type>mysql</type>
<host>192.168.1.10</host>
<name>xbmc_music</name>
<port>3306</port>
<user>xbmc</user>
<pass>xbmc</pass>
</musicdatabase>

All you have to do is update the <host> IP address to point to the computer running your MySQL instance, restart XBMC, and it should start using the databases you created.  If you’re still having troubles you can head on over to the XBMC Wiki to take a look at some of their OS-specific tips.

Share Settings and Add-on Configuration Files:

XBMC also has what they refer to as a special protocol that will let you configure local files to be shared among multiple instances thanks to path substitution. What that means is that you can tell XBMC to redirect any requests to specific files/folders to a remote location on another computer.

Below you can see I’m redirecting all kinds of locations including thumbnails used for movies/TV shows, playlists, addon configuration data, all of my media sources, and more.

To get started on each of the clients navigate to the following directory:

  • Mac: ~/Library/Application Support/XBMC/userdata/
  • Windows: %appdata%\XBMC\userdata\

If you don’t see a file named advancedsettings.xml go ahead and create it, but if it does exist just open it up. You’ll then want to add the lines below and update the “to” node of each substitution to match how your system is set up. The “smb” refers to the Samba protocol I’m using to connect to the share, the “192.168.1.10″ is the IP address of the computer hosting the files, and the “XBMC” is the share name on that server.

<pathsubstitution>
<substitute>
<from>special://masterprofile/Thumbnails/</from>
<to>smb://192.168.1.10/XBMC/Thumbnails/</to>
</substitute>

<substitute>
<from>special://masterprofile/playlists/</from>
<to>smb://192.168.1.10/XBMC/Settings/playlists/</to>
</substitute>

<substitute>
<from>special://masterprofile/addon_data/</from>
<to>smb://192.168.1.10/XBMC/Settings/addon_data/</to>
</substitute>

<substitute>
<from>special://masterprofile/sources.xml</from>
<to>smb://192.168.1.10/XBMC/Settings/sources.xml</to>
</substitute>

<substitute>
<from>special://masterprofile/mediasources.xml</from>
<to>smb://192.168.1.10/XBMC/Settings/mediasources.xml</to>
</substitute>

<substitute>
<from>special://masterprofile/RssFeeds.xml</from>
<to>smb://192.168.1.10/XBMC/Settings/RssFeeds.xml</to>
</substitute>

<substitute>
<from>special://masterprofile/favourites.xml</from>
<to>smb://192.168.1.10/XBMC/Settings/favourites.xml</to>
</substitute>

<substitute>
<from>special://masterprofile/profiles.xml</from>
<to>smb://192.168.1.10/XBMC/Settings/profiles.xml</to>
</substitute>
</pathsubstitution>

Once you have this all in place just restart XBMC for the changes to take effect, and you should see it start using those locations for storing the files.

CyberNet’s XBMC Guides:

There Are 8 Comments

  1. My SQLFu is not too strong, but I think you need to make a small correction to the section on adding the MYSQL database information to the XML file.

    192.168.1.10
    xbmc_music
    3306
    xbmc
    xbmc

    The DB entry that looks like this: xbmc_music should be look like this: xbmc_video

    • Oops, thanks for pointing that out. Bad copy and paste error on my part. I updated the database name for the video node.

  2. I have just started looking into using MySQL as the DB backend, I was reading that doing a symlink seems to be preferred (faster) than using the advancedsettings.xml file. Have you found any latency using the advancedsettings.xml? I think my use case is a little different than most, I am looking at using MySQL to allow my HTPC whether in Windows, XBMCbuntu or OpenELEC to have the same up to date DB. Some of the other HTPC’s are used by other people so I don’t want their watched status/settings and so on. One last point, did you look into these changes, you’re already doing the first tip.

    In advancedsettings.xml:
    Use the IP address and NOT the hostname of your MySQL server
    In my.ini:
    (add to mysqld section)
    skip-name-resolve

    Thanks for another great article!

    • I have seen no noticeable performance issues using the advancedsettings.xml method rather than symlinks. I wanted to go the route of using the advancedsettings.xml method because it was easy for me to set up on all my systems. I could just copy the same file across and they would all instantly start using the same paths. Otherwise I would need to go through and set up the symbolic links on each system, which is even more of a pain if you have multiple systems running different OS’s. Just something to think about, but I have no complaints. Of course my whole network is wired with Cat6, so maybe it would be more noticeable if I was doing this over wireless.

      In terms of using the IP address I did read that tip, and that’s why I mentioned using the IP address of the MySQL server in the article. I haven’t done the skip-name-resolve step though, but might since it it’s a quick thing to do. I don’t think it will have much impact though.

  3. Ryan,

    Thank you for the response, I will let you know how my testing goes. I am also using Cat 6 and Gig in my house. I hope I won’t see some of the performance issues others have seen, I would (like you) prefer to have a file I drop into any system and be ready to rock.

    With MQ3 are you able to use banners, extra fanart, logos, cdart, ect? I wonder if that has any baring on load speeds.

    • I don’t have the plugin installed that downloads all of the extra artwork (like logos and stuff) so I tend to not use those views. I generally stick with banners and the typical fanart that comes from theTVDB. It does have a bunch of extra views in the theme that take advantage of the different kinds of imagery that some of the other plugins will download for you.

  4. Nice guide. You can remove the database creation step. XBMC Eden takes care of all of that for you.

  5. as far as the “XBMC share”. are you just sharing “%appdata%\Roaming\XBMC\userdata”

    ?

Leave Your Comment


Message is the only required field.
Emails are not published.