If you have more than one device with a kodi player in your home network, you would definitely like to have a shared library, so that the information in the library between devices syncs just like in plex. Using shared library databases allows you to store information about your video or music library in a central database so that multiple devices can access the same information simultaneously.
In the home network, this is possible using the MySQL protocol. Both MySQL and MariaDB use it. More and more Linux distributions are switching to MariaDB and drop MySQL. However, both are compatible with each other.
For library sharing to work, one of the devices must have MySQL server installed, and the other devices will connect to it. The server can run on both windows and linux. I prefer Ubuntu.
It is important to remember that the same version of Kodi should be installed on each device.
Installation MySQL server
sudo apt-get install mysql-server
A password must be provided during installation.
When using MySQL8 or higher (Ubuntu 20.04 or later), add the following line at the end of /etc/mysql/mysql.conf.d/mysqld.cnf:
Restart MySQL server:
sudo service mysql restart
Get into the MySQL command line utility:
mysql -u root -p
Create a kodi user for MySQL:
CREATE USER 'kodi' IDENTIFIED BY 'password';
MySQL8 or newer:
CREATE USER 'kodi' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON *.* TO 'kodi'; flush privileges; \q
Konfiguracja klientów kodi
Client configuration consists in creating the advancedsettings.xml file and copying it to the Userdata directory of each client.
Depending on the operating system, the Userdata directory is in the following locations:
|Operating system||Userdata folder location|
|Nvidia Shield (SMB)||smb://<nvidiashieldurl>/internal/Android/data/org.xbmc.kodi/files/.kodi/userdata|
|Windows Portable||<Install location chosen by you>\portable_data\userdata\|
The advancedsettings.xml file should be as follows:
<advancedsettings> <videodatabase> <type>mysql</type> <host>***.***.***.***</host> <port>3306</port> <user>kodi</user> <pass>password</pass> </videodatabase> <musicdatabase> <type>mysql</type> <host>***.***.***.***</host> <port>3306</port> <user>kodi</user> <pass>password</pass> </musicdatabase> <videolibrary> <importwatchedstate>true</importwatchedstate> <importresumepoint>true</importresumepoint> </videolibrary> </advancedsettings>
After that, you need to add video sources to your clients in a format recognized by kodi. These will be network locations, for example:
After that, the shared library should work.