MySQL: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
mNo edit summary
 
(228 intermediate revisions by 14 users not shown)
Line 1: Line 1:
'''''Notice:''' These instructions require the latest nightly build of XBMC (pre-Eden v11)''
{{divbox|orange||<big>'''NOTICE:''' This is considered an advanced (complicated) and experimental feature.</big>}}
{{divbox|red||{{huge|'''NOTICE:''' Every {{kodi}} "client" '''must''' run the same version of {{kodi}}.}}<br />Otherwise they will not be sharing the same library. There can even be differences between [[development builds]], so make sure you always use the same build dates. See '''[[Databases#Database_Versions|Version table]]''' for more info. }}
{{:MySQL/Contents}}
{{See also|Databases}}


Into about what this is and how cool it is to sync XBMC libraries goes here
[[File:Network.png|200px|left]]
;<big><u>Introduction</u></big>
<section begin="intro"/>If you have more than one {{kodi}} device on your local network then you might want to synchronize them by sharing the Kodi library databases via the MySQL protocol. Using shared library databases allows you to store information for either your video or music library in a central database, so that multiple devices can access the same information at the same time.<section end="intro"/>


==Selecting a server==
This gives you the ability to do things like:
Something about needing to choose which of your XBMC boxes (or NAS box) will be the MySQL server. Needs to be on 24/7 or have wake-on-lan (preferably the former), needs to have a static local IP, etc.
* Share watched and unwatched status for your media on all devices
* Stop watching a movie or TV show in one room then finish watching it in another room automatically
* Only one library to maintain for all devices
{{-}}


==Setting up the MySQL server==
;{{big|MySQL Protocol & MariaDB}}
#Download a copy of MySQL server for your OS: http://dev.mysql.com/downloads/mysql/
<section begin="MariaDB" />When setting up shared Library databases either MySQL or MariaDB can be used as they both use the same MySQL protocol. Since many Linux distributions have dropped including MySQL and now instead now ship MariaDB, it is being more common to use MariaDB for shared Library databases.<section end="MariaDB" />
#Run the installer and select the ''Standard configuration''
#Create a password when asked
#Select that you want the database to have network access
#Get into the MySQL command line interface.
#:'''Windows:''' Open the "MySQL Command Line Client" from the MySQL start menu
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return
##Type in: <code>CREATE database xbmc_video;</code> and press return
##Type in: <code>CREATE database xbmc_music;</code> and press return
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return
#Close out the command line tool


==Setting up XBMC==
{| class=infobox
| advancedsettings.xml:
|-
|
<pre><advancedsettings>
    <videodatabase>
        <type>mysql</type>
        <host>***.***.***.***</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
        <name>xbmc_video</name>
    </videodatabase>


    <musicdatabase>
{{next|[[MySQL/Setting up MySQL|Setting up MySQL]]}}
        <type>mysql</type>
        <host>***.***.***.***</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
        <name>xbmc_music</name>
    </musicdatabase>
</advancedsettings></pre>
|}
#Open XBMC on the computer that has the library you want to share ''(If you have not created a library yet you can skip this step)''
#:'''Notice:''' If your video library contains local file paths (e.g. C:\Videos\) instead of network file paths (such as SMB shares) then this will not work. You will need to convert your exported library files by following these instructions. ''<-Need a link or new wiki page for this''
##Export the Video Library by doing the following:
###Go to '''System/Settings -> Video -> Library''' and select '''Export library'''
###Select '''Single file'''
##Export the Music Library by doing the following:
###Go to '''System/Settings -> Music -> Library''' and select '''Export library'''
###Select '''Single file'''
#Create (or add to, if you already have one) an advancedsettings.xml file:
##Open up a plain text editor
##Copy and paste the text from the right-hand box into a new text document
##Replace the two instances of <code><host>***.***.***.***</host></code> with local network IP address of your MySQL server
##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:''' <code>Documents and Settings\<your_user_name>\Application Data\XBMC\userdata\advancedsettings.xml</code>
#* '''Vista/Windows 7:''' <code>Users\<your_user_name>\AppData\Roaming\XBMC\userdata\advancedsettings.xml</code>
#* '''Mac OS X:''' <code>/Users/<your_user_name>/Library/Application Support/XBMC/userdata/advancedsettings.xml</code>
#* '''iOS:''' <code>/private/var/mobile/Library/Preferences/XBMC/userdata/advancedsettings.xml</code>
#* '''Linux:''' <code>$HOME/.xbmc/userdata/advancedsettings.xml</code>
#Open any of your XBMC installs and re-import your library data ''(If you have not created a library yet you can skip this step)''
##Import the Video Library by doing the following:
###Go to '''System/Settings -> Video -> Library''' and select '''Import library'''
###Select the file you saved from the first step when you exported your video library
##Import the Music Library by doing the following:
###Go to '''System/Settings -> Music -> Library''' and select '''Import library'''
###Select the file you saved from the first step when you exported your music library
#You can now add files and update the library from any of your XBMC boxes and the library for all of them will stay in sync.


==Syncing thumbnails and fanart==
{{Updated|16}}
Pathsub instructions go here


[[Category:How-to]]
[[Category:How-to]]
[[Category:File sharing]]
[[Category:Guides]]
[[Category:Advanced topics]]

Latest revision as of 04:51, 23 January 2022

Share libraries w/MySQL, guide:

  1. Introduction
  2. Setting up MySQL
  3. Setting up Kodi
Network.png
Introduction

If you have more than one Kodi device on your local network then you might want to synchronize them by sharing the Kodi library databases via the MySQL protocol. Using shared library databases allows you to store information for either your video or music library in a central database, so that multiple devices can access the same information at the same time.

This gives you the ability to do things like:

  • Share watched and unwatched status for your media on all devices
  • Stop watching a movie or TV show in one room then finish watching it in another room automatically
  • Only one library to maintain for all devices


MySQL Protocol & MariaDB

When setting up shared Library databases either MySQL or MariaDB can be used as they both use the same MySQL protocol. Since many Linux distributions have dropped including MySQL and now instead now ship MariaDB, it is being more common to use MariaDB for shared Library databases.


Next step: Setting up MySQL