MySQL/Setting up Kodi

Each device that will be sharing a library will need an advancedsetting.xml file.

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 Kodi devices by sharing them on the network through file sharing. Kodi itself or the MySQL server will not share the actual files for this setup. Most operating systems have built-in methods for sharing files to the network, or a NAS device can be used.

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

Exporting

 * 1) Open Kodi on the computer that has the library you want to share
 * 2) Export the Video Library by doing the following:
 * 3) Go to System/Settings -> Video -> Library and select Export library
 * 4) Select Multiple files
 * 5) Export the Music Library by doing the following:
 * 6) Go to System/Settings -> Music -> Library and select Export library
 * 7) Select Multiple files

MySQL and advancedsettings.xml

 * 1) Create (or add to, if you already have one) an advancedsettings.xml file:
 * 2) Open up a plain text editor
 * 3) Copy and paste the text from the right-hand box into a new text document
 * 4) 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.
 * 5) Save the file as advancedsettings.xml
 * 6) Copy this advancedsettings.xml file you just created to the userdata folder of every Kodi install you want to sync with.

Importing
At this point Kodi is using the MySQL server for the database, which means it has a new blank library. Now we can either import an old library (see below) or simply start a new library (see adding videos to the library). From this point on, Kodi behaves exactly like it would as if it had a local database, except that database is on the MySQL server and multiple installs can access that single database.

You can now add files and update the library from any of your devices and the library for all of them will stay in sync.
 * 1) Open any of your 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 Kodi and scan it in as if you were setting up your library for the first time (see adding videos to the library). However, Kodi 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.
 * 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.
 * 1) 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.

Adding new Kodi devices to the MySQL setup
Since the database has now been set up on the MySQL server, all you need to do for any additional devices is add the advancedsettings.xml file. You don't need to do any of the other steps, such as rescanning or reimporting. If it works on one device then it should work on all of them, as they are basically sharing the same "brain".

If you however used a metadata collector add-on (scraper) that does not ship by default with new installations, such as the Universal Movie Scraper you will not be able to display the media information screen on the new Kodi device. To fix that you need to install the same metadata collector add-on on the new device.

Name tag
An additional  tag can be used for both the   and   entries in advancedsettings.xml file, if you want to change the name of the database. The  tag is not required. Kodi will use "MyVideos" and "MyMusic" as database names if the  tag is not specified.

You may want to do this if you want to have multiple separate libraries (with different content) on the same MySQL server. For example, if you want to create multiple profiles, each with their own shared library, so that each Kodi device can "log-into" that library. (a kids library, a guest library, etc)