MySQL: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
mNo edit summary
 
(78 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{divbox|navy|radius=4em||'''Requirements:''' These instructions require the latest nightly builds of XBMC (pre-Eden v11) or one of the Betas. Make sure all your XBMC devices are on the same build date (or at least close).}}
{{divbox|orange||<big>'''NOTICE:''' This is considered an advanced (complicated) and experimental feature.</big>}}
{{XBMC wiki toc}}
{{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. }}
If you have more than one XBMC device on your local network then you might want to synchronize them using a MySQL library. Using a MySQL library allows you to store information about your whole video library in a central database, so that multiple XBMC devices can access the same information at the same time. This gives you the ability to:
{{:MySQL/Contents}}
{{See also|Databases}}
 
[[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"/>
 
This gives you the ability to do things like:
* Share watched and unwatched status for your media on all devices
* 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
* 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
* Only one library to maintain for all devices
* Consolidate thumbnails and fanart to save hard drive space
{{-}}
 
== Share your files ==
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. Most of XBMC's file sharing protocols will work except for UPnP.
 
 
See [[:Category:File Sharing]] for some of the file sharing methods that work with XBMC.


== Setting up the MySQL server ==
;{{big|MySQL Protocol & MariaDB}}
You'll need to choose which of your computers, XBMC devices, or [[NAS]] will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.
<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" />


=== On a computer ===
{{incomplete}}
MySQL can be installed on just about every major OS:
#Install MySQL server
#*'''Windows/Mac OS X:''' Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/
#**'''Windows''': select ''Standard configuration''
#*'''Linux:''' <code>$sudo apt-get install mysql-server</code> ''(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )''
#Create a password when asked
#Give the database access to your network:
#*'''Linux:''' Comment out the following line in the MySQL configuration file (/etc/mysql/my.cnf)
#:#from: <code>bind-address = 127.0.0.1</code>
#:#to    : <code>#bind-address = 127.0.0.1</code>
#*'''Mac OS X:'''
#*'''Windows:''' Select that you want the database to have network access when prompted during installation.
#Get into the MySQL command line interface:
#*'''Linux:''' <code>$mysql -u root -p</code>
#*'''Mac OS X:'''
#*'''Windows:''' Open the "MySQL Command Line Client" from the MySQL start menu
#Enter the following commands:
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return
#:{{editor note|1=Note these "speed up" commands here -> http://xbmcstuff.bossanova808.net/2011/03/summary-of-xbmc-mysql-database.html?m=1 }}
#Close out the command line tool


=== On a NAS ===
{{next|[[MySQL/Setting up MySQL|Setting up MySQL]]}}
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. See one of the following guides for more info:
*[http://www.vectorsigmastudios.com/index.php?page=tutorial&id=2 Pogoplug for a MySQL db in XBMC]
*[http://ozymandyaz.blogspot.com/2011/08/configure-synology-nas-as-mysql-server.html Synology NAS as MySQL server for XBMC]


== See also ==
{{Updated|16}}
*[[MythTV:Category:MySQL]]


[[Category:How-to]]
[[Category:How-to]]
[[Category:File Sharing]]
[[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