Login

Source: 

Issues were reported with MySQL 5.6. Use MySQL 5.5 instead. 
  Future Gotham feature: This is now fixed in nightly builds!  

 

Setting up MySQL

Windows:

  1. Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/
  2. Select Standard configuration
  3. Create a password when asked
  4. Select that you want the database to have network access when prompted during installation.
  5. Open the "MySQL Command Line Client" from the MySQL start menu
  6. Enter the following commands:
    1. Type in: CREATE USER 'xbmc' IDENTIFIED BY 'xbmc'; and press return
    2. Type in: GRANT ALL ON *.* TO 'xbmc'; and press return
  7. Close out the command line tool
  8. If you're using a firewall such as the one that's built into Windows, you will need to do this next step.
  • Windows 7 Built-in Firewall
  1. Go to control panel and open Windows Firewall
  2. Click on Advanced Settings
  3. Click on Inbound Rules, then New Rule
  4. For the Rule Type, choose Port and hit Next
  5. For Protocol and Ports, select TCP protocol and type in 3306 for the Specific local ports and hit Next
  6. For Action, leave it at default which is Allow the connection and hit Next
  7. For Profile, you can leave it as default (everything checked by default) and hit Next
  8. For Name, set it to MySQL or any name that you will know what it is and click Finished
  • Windows XP Built-in Firewall
  1. Open Control Panel and Set to 'Classic View'
  2. Double Click on Windows Firewall
  3. Click on tab that says Exceptions
  4. Click on Add Port
  5. Name it MySQL or any other name
  6. Set the port number to 3306
  7. Choose TCP and click OK
Note: If XBMC is unable to connect to the MySQL server, it will return an error code [1130]:

If this occurs to you, try amending Step 2 above to read GRANT ALL ON *.* TO 'xbmc'@'xxx.xxx.xxx.%'; where xxx.xxx.xxx is the first three quadrants of your home network's IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.

 

Share libraries using MySQL/Setting up XBMC

1. Make files accessible over the network

If you haven't already done so, you will need to make your media files accessible to all your XBMC devices by sharing them on the network through file sharing. XBMC itself or the MySQL server will not share the actual files for this set up. Most operating systems have built-in methods for sharing files to the network, or a NAS device can be used.

 

Note:
  • If you use passwords on your network shares then you will need to copy (or sync) your passwords.xml file from the userdata folder to each XBMC device.
  • Do not use mapped drives on the OS-level, as XBMC will see those as local drives.
  • If you use smb:// paths, you may want to use static IP addresses rather than NetBIOS names, as not all your devices may be able to resolve the later.
  • Even if the media is on the same computer as one of the XBMC instances, you MUST use a network share path. You cannot use a local file path with MySQL.


See Category:File Sharing for some of the file sharing methods that work with XBMC.

2. Exporting

You only need to do the exporting steps if you are migrating an existing local library to a MySQL database.

  1. Open XBMC on the computer that has the library you want to share
    1. Export the Video Library by doing the following:
      1. Go to System/Settings -> Video -> Library and select Export library
      2. Select Multiple files
    2. Export the Music Library by doing the following:
      1. Go to System/Settings -> Music -> Library and select Export library
      2. Select Multiple files
Please Note: Don't create the MySQL databases on your server, before you start your XMBC with your newly configured advancedsettings.xml. Let XBMC create everything for you...

 

Ensure MySQL-user has enough permissions.

Else it results in an error like:

ERROR: SQL: The table does not exist
Query: SELECT idVersion FROM version

3. MySQL and advancedsettings.xml

advancedsettings.xml:
<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>

See also this note about using the <name> tag: #Name tag
<importwatchedstate> is only needed when you're importing a previous library from exported files.

  1. Create (or add to, if you already have one) an advancedsettings.xml file:
    1. Open up a plain text editor
    2. Copy and paste the text from the right-hand box into a new text document
    3. Replace the two instances of ***.***.***.*** with local network IP address of your MySQL server. If you installed MySQL on a Windows machine, do not use its NetBIOS name, as not all devices may be able to resolve them.
    4. Save the file as advancedsettings.xml
  2. Copy this advancedsettings.xml file you just created to the userdata folder of every XBMC install you want to sync with.

 

4. Importing

  1. Open any of your XBMC installs and re-import your library data, or simply set up a new library if you are starting fresh.
  2. Add (or just "set content" on) the networked video source to XBMC and scan it in as if you were setting up your library for the first time (see adding videos to the library). However, XBMC will read the exported nfo files and images and use those instead of rebuilding the library from scratch. The end result will be an identical library, and your watched status for videos will be preserved.
    Note: You must add a network source using XBMC's standard formatting. For example, use "smb://192.168.1.20/Videos/" and not "\\BOBPC\Videos\". Try to use static IP addresses over NetBIOS names if using SMB.
  3. Import the Music Library by doing the following: Same idea as videos, but using the steps for adding music to the library. You'll end up with an identical library.

You can now add files and update the library from any of your XBMC devices and the library for all of them will stay in sync.

5. Name tag

An additional <name> tag can be used for both the video and music entries in advancedsettings.xml if you want to change the name of the database.

The name tag is not required (XBMC will use a default "MyVideos" and "MyMusic" DB name) and it is recommended to not include it if you only need one library, as some users have reported problems/bugs when it was included.

The tag is only needed if you want to have separate databases on the same MySQL server, like for more than one shared library. For example, if you want to create multiple profiles, each with their own shared library, so that each XBMC device can "log-into" that library.

Go to top