XBMC – Mysql setup

Just a quick post on setting up xbmc to use mysql

to start you will need to have mysql server installed and running this can be under windows or linux / mac / ect

I have a synology raid box that has mysql installed so thought it would make sense to use that.

time to create a user, some databases, and assign our new user some privileges. First we’ll be creating a user account for all of our XBMC installations. They’ll be sharing the same login. At the commend prompt type in:

CREATE USER ‘xbmc’ IDENTIFIED BY ‘xbmc’;

You just created the login/password pair xbmc/xbmc. Since this database is just for a media center and just for use on a private network we’re not going to concern ourselves with heavy security. You can, of course, go more secure if you like.

After you’ve created your user account, it’s time to create some databases for XBMC. Type the following:

CREATE database xbmc_video;
CREATE database xbmc_music;

Now we have a user “xbmc”, and two databases. XBMC requires a separate database for the video library and the music library.

Finally, we need to give our user access to the databases. Again, since we’re not concerned with securing confidential records or the like, we’ll take the easy way out here to minimize the amount of typing and fussing we need to do. Type the following command at the prompt:

GRANT ALL ON *.* TO ‘xbmc’;

Now user “xbmc” has access to all our databases. To confirm that everything’s in order so far, fire off the following commands:

SELECT host,user from mysql.user;
SHOW DATABASES;

If everything is in ship shape, you’ll see results like those in the screenshot above. Now all that’s left to do is tell XBMC how to access the database and start sharing information through it.

Step Two: Configure XBMC to Use Your New Database

As with any software-based tinkering, we recommend backing up before proceeding, so let’s do that first.

Under the Settings menu in Video and Music, respectively, you’ll find an Export Library button. Export the video and music library for safe keeping. We’ll be importing them shortly.

Once you’ve exported your libraries, open up your favorite text editor and copy the following text into a new file:

mysql
***.***.***.***

3306 xbmc xbmc xbmc_video
mysql
***.***.***.***

3306 xbmc xbmc xbmc_music

Replace ***.***.***.*** with the IP address of the computer on your network that is hosting the MySQL database. If you altered the MySQL server port during the installation, make sure to change it. (If you didn’t, the default was 3306.) In Windows, save this file as advancedsettings.xml in the %APPDATA%\XBMC\userdata—just copy and paste that text into the Explorer address bar or the Run box. (On Linux, the path should look something like ~/.xbmc/userdata; on OS X, something like ~/Library/Application Support/XBMC/userdata.

Once you’ve copied the file to every XBMC installation on your network, start one of them up and import the music and video libraries you exported. This freshly imported—or freshly scanned, if you’re starting from scratch—library will populate the database on your primary machine/server. From here out your XBMC viewing habits will sync between machines and you’ll be able to resume playback, access bookmarks, and see what media you’ve already viewed from anywhere in your house. The first screenshot below is taken from the XBMC center in one room and the second was taken in another room; both XBMC installs feed from the central database.

Note how the second XBMC install knows that we already watched the first episode and that we paused the second one 45 seconds into the show. In addition to remembering which shows we’ve watched and where we left off, the database also remembers things like subtitle settings, if we’ve zoomed the screen in, video modes, and more. If you’re curious to see everything currently shared by the XBMC database, you can check out this developer’s thread, complete with charts that highlight all the variables that’ll sync between installations.

One current shortcoming with the database system—although rumored to be in the pipe for future releases—is that thumbnails and fanart are cached locally and not stored with the database. While creative users in the XBMC forums have come up with solutions to work around this like using symbolic links and moving your thumbnail cache, there is a much easier solution. We’d strongly recommend you go check out our guide to whipping your movie and TV show art into shape for XBMC. The method we outline in the guide results in all your thumbnails, movie posters, fan art, and more being stored with your media. It’s the best way to do it and it makes reinstalling XBMC or adding a new install to your network a breeze since the “scraping” it does is from the local network and not a distant server. If you combine local artwork storage with a MySQL media database you’ll have the fastest home media network around.

Have a favorite XBMC tip, trick, or add-on to share? Let’s hear about it in the comments. We love a good media center, especially a powerful and open-source one, and we always love to hear about new ways to make them better.

Using ATV2 with 4.2.1 firmware.

I have in /private/var/mobile/Library/Preferences/XBMC/userdata/advancedsettings.xml:

mysql
10.11.12.100

3306 xbmc xbmc xbmc_video
mysql
10.11.12.100

3306 xbmc xbmc xbmc_music

Author: admin