Use a Raspberry Pi for OSMC and as a mysql server for other KODI on my network

I have an OSMC on a Raspberry PI 3B+ with a 2TB external disk on USB port. This RPI is also used as a mysql server for video and music DB and as video and music files container (on external disk) of a recalbox KODI on a RPI 4.
It works well with that recalbox KODI. But I would like to use that DB with the local OSMC. I don’t know how to code advancedsettings.xml and path to video and music directories.
Thanks for help.

Well you could set all of that via the GUI if you feel more comfortable with that.
MYSQL can be set at MyOSMC → Network → MySQL
Sources you can add in the respective sections (Videos/Music) via Add Source.

Important for using a central MySQL database all Kodi installations must be using the same major Kodi Version (e.g. v18 or v19) and the access to the files must be identical otherwise you would need to use pathsubstitution.

If you want to change the files directly you would use the command line and then use nano .kodi/userdata/advancedsettings.xml to edit the file

Details regarding how to access the command line interface can be found here on our Wiki: Accessing the command line - General - OSMC

problems with my text. Must be better like that :
Thanks fzinken for your answer.
I know advancedsettings.xml must look like that :

<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>***.***.***.***</host>
    <port>3306</port>
    <user>kodi</user>
    <pass>kodi</pass>
  </videodatabase> 
  <musicdatabase>
    <type>mysql</type>
    <host>***.***.***.***</host>
    <port>3306</port>
    <user>kodi</user>
    <pass>kodi</pass>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
</advancedsettings>

and it works well for me from a KODI on recalbox (RPI4).
So does it mean I have to code :

<host>localhost</host>

or

<host>127.0.0.1</host>

and so connect to a local mysql thru network ? I hoped that a more direct solution exists.

I’m using samba from that RPI4 for paths to videos and audios :

smb://192.168.0.30/path/to/directory

and mysql DBs were populated from that RPI4.
Again do I have to use network and samba to access local directories ? Can pathsubstitution help ?

I didn’t test these definitions thru network because I supposed more direct ones exist.

That is the setting for the machine on which Kodi and the MySQL server is running.
For all other machines you need to replace 127.0.0.1 with the LAN IP of the MySQL Server.

That should work no need for path substitution

Thanks again fzinken.

I know about how to code that <host> parameter on advancedsettings.xml, but I thought there was another way instead of using a listening port to connect to mysql. I will try it.

About paths, I hope that using smb://192.168.0.30/path/to/directory on an external KODI and /path/to/directory on local one will point to the same mysql records. I was not sure it will work, but I will try.

Regards.

Not sure what you had in mind there!

No that will not work, you have to options:

  1. Use pathsubstitution
  2. Use Kernel Based mounts on the external Kodi using the same path structure.

Sorry not to reply very quickly (I’m on another issue with recalbox for a couple of days).
Anyway I’ve set my advancedsettings.xml with localhost and it works.
And you’re right fzinken, I had to code smb://192.168.0.30/path/to/directory to make paths work.
I’m not happy about that because I think using network to connect from and to the same machine is not very fast and effective. But it works.
Thanks for help.
Topic closed.

You can use path substitution instead.