GUIDE: How to use XBMC with MySQL on Mac OS X

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Rumik Offline
Fan
Posts: 320
Joined: Nov 2010
Reputation: 1
Post: #1
I've searched all over the internet for a single place that has an up to date guide on how to get MySQL working with XBMC 11 or 12 on Mac OS, and there just isn't one, so I thought I'd write one myself, with information gathered from multiple sources.

This definitely works.

Download MySQL from here: http://dev.mysql.com/downloads/mysql/.

Mount the downloaded .dmg, and inside you’ll find two .pkg and one .prefPane files. Double-click to install all three files on one of your Macs that you keep running 24/7.

Go to System Preferences -> MySQL, and click on “Start MySQL Server”. You’ll also want to tick to enable the “Automatically … on Startup” option.

Launch the Terminal app on your Mac and issue the following commands, one line at a time:

Quote:sudo /usr/local/mysql/bin/mysql

This will load up the MySQL command line interface. The type:

Quote:CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';
Quote:GRANT ALL ON *.* TO 'xbmc';

DO NOT create any databases here yourself. That's the problem I had - loads of guides tell you to create databases for video and music, but they are OUT OF DATE. XBMC will create the databases for you.

Now, if you want other devices on your network to access the XBMC databases (which of course you do), then exit out of the MySQL command line interface by typing exit and type the following:

Quote:cd /usr/local/mysql/support-files/
Quote:sudo cp my-huge.cnf /etc/my.cnf

This creates the my.cnf file in the right place the MySQL needs. It's possible that your installation already has it, but mine didn't. Either way, the next thing you'll want to do is edit it. Type this:

Quote:cd /etc
Quote:sudo nano my.cnf

This will open the file for editing. You'll want to scroll down to the [mysqld] section and add in or edit (if it exists) the following line:

Quote:bind-address = ***.***.***.***

If you already have this entry, it will likely say 127.0.0.1 - this IP address is "localhost" and will only allow the machine itself to use the MySQL database. Change this to the IP address of your machine.

Save and exit, and reboot the machine (or just restart the MySQL service from the command line or from the System Pane you installed earlier).

Now, depending on what platform you are running your XBMC clients on (Linux, Windows, OS X, etc), the file you need to create next will need to be saved in different places.

Create (or add to, if you already have one) an advancedsettings.xml file:

Open up a plain text editor
Copy and paste the following text into a new text document:

Quote:<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>
</advancedsettings>

Replace the two instances of ***.***.***.*** with the IP address of your Mac.
Save the file as advancedsettings.xml

Copy this advancedsettings.xml file you just created to the userdata folder of every XBMC install you want to sync with:

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

Now start up XBMC and it will create the required databases itself, and you should be good to go!

Enjoy!

[Image: watched-fanart.jpg]
find quote
nmirza Offline
Fan
Posts: 330
Joined: Mar 2008
Reputation: 0
Post: #2
Thanks for the guide. Quick question. I already have about 10tb of movies and tv shows scanned in. If i switch to mysql will xbmc automatically trasnfer that library over to mysql or will i havr to reconfigure sources and rescan?
find quote
Rumik Offline
Fan
Posts: 320
Joined: Nov 2010
Reputation: 1
Post: #3
If you go into Settings and Video, you can export your database to a single file. Once you switch over to MySQL, you can import the database, which should restore it exactly as it was.

[Image: watched-fanart.jpg]
find quote
Ned Scott Offline
Team-XBMC Wiki Guy
Posts: 19,921
Joined: Jan 2011
Reputation: 247
Location: Arizona, USA
Post: #4
Awesome! I've updated the wiki MySQL guide with the basic steps you've provided here, but I might expand it to be more descriptive like your guide to help make it easier to understand. In any case, thanks for filling in the blanks!

You can make easy links to the XBMC wiki using double brackets around common XBMC words: [[debug log]] = debug log, [[Video library]] = Video library, [[SMB]] = SMB , [[userdata]] = userdata, etc
find quote
nmirza Offline
Fan
Posts: 330
Joined: Mar 2008
Reputation: 0
Post: #5
(2013-01-11 19:25)Rumik Wrote:  If you go into Settings and Video, you can export your database to a single file. Once you switch over to MySQL, you can import the database, which should restore it exactly as it was.

Thanks. I once copied over my library via this export function and then imported. Had two issues. 1- no souces were listed in video- files. 2- while i got all my movies thumbnails etc i could notpress info on a movie to get the popup with more info. Maybe that was an issue from back in the day. Do you know if this is still the case?
find quote
Ned Scott Offline
Team-XBMC Wiki Guy
Posts: 19,921
Joined: Jan 2011
Reputation: 247
Location: Arizona, USA
Post: #6
1 - Sources aren't actually apart of the library. If you want the file sources to appear the same on each machine then see the "Syncing other part" step of MySQL.

2 - Debug log needed.

You can make easy links to the XBMC wiki using double brackets around common XBMC words: [[debug log]] = debug log, [[Video library]] = Video library, [[SMB]] = SMB , [[userdata]] = userdata, etc
find quote
boosterbosch Offline
Junior Member
Posts: 7
Joined: Jun 2013
Reputation: 0
Post: #7
I currently have a mysql db running on a Windows 7 machine and I want to move that database to a mac mini.

Is there an easy way of migrating this database from the Windows 7 machine to the Mac?
find quote