MySQL Clarification

Hi there. I recently replaced Libreelec with OSMC on my Raspberry Pi 3 to serve as a Kodi client but to also run as a MySQL server for my Chromebox upstairs. Before I started with command line stuff I just wanted to clarify the purpose of the MySQL settings in MyOSMC. Is that solely to connect to an outside server or can I use that to set it up on a machine I’m using as a client as well?

You can connect to a local server by putting 127.0.0.1 in the server / host option.

Thanks for the reply. And when I go to set up the second client I just follow the normal procedure and use the ip address of the host kodi device?

That’s right.

Sorry, I didn’t think about this because the Pi is in our room and the kids don’t use it so we don’t have multiple profiles like we do on the Chromebox, but when I go to connect our Chromebox and SSH into it, how do I know which profile’s library I am telling it to use? I haven’t seen anything that addressees different profiles with MYSQL.

Unfortunately, the current Kodi implementation of MySQL does not handle profiles well.

If you are trying to have separate librarys, but still shared (example: Kids profile available on all systems, Adult profile on all systems) it can be done.

You would need to create your profiles, and in each profiles advancedsettings.xml point to a database for that profile. (The databases can be hosted on the same MySQL server)

Then do your scan to populate the database. Log out of that profile, log into the next profile and repeat.

When adding new content you will need to do a scan of each profile. Using texturecache.py can help with this!

Then on the other system you would just use each profiles advancedsettings to point to the proper version of the database.

It’s mainly our (grown ups) media I want to synchronize. The kids have their separate profile and library but only watch it on one device so it wouldn’t be necessary.

Ok, you can actually have the kids profile just use a local database (MySQL or the built in database) and the adults have a separate shared MySQL database.

In the .kodi/profile/PROFILE_NAME directory, just create an advancedsettings.xml to point to the shared database.

I apologize for my ignorance but I have never actually messed with advanced settings before. What would I do differently from the basic instructions for connecting a client device to a MySQL server to make it profile specific?

Assuming you have 2 profiles, the Master profile (the default one) and a Kids profile then you would create a new advancedsettings.xml in

/home/osmc/.kodi/userdata/profiles/Kids

Anything in that will override the main advancedsettings.xml, so for example if the main profiles database settings look like this:

<advancedsettings>
 <videodatabase>
	<name>kodi_video</name>
	<host>127.0.0.1</host>
	<user>kodi</user>
	<pass>kodi</pass>
	<type>mysql</type>
	<port>3306</port>
</videodatabase>
</advancedsettings>

then you could do something like this in the Kids advancedsettings:

<advancedsettings>
 <videodatabase>
	<name>kodi_kids_video</name>
	<host>127.0.0.1</host>
	<user>kodi</user>
	<pass>kodi</pass>
	<type>mysql</type>
	<port>3306</port>
</videodatabase>
</advancedsettings>

So with this setup, the main profile would use the kodi_videos database and the Kids profile would use the kodi_kids_videos database. After creating the new advancedsettings you will need to restart Kodi for the database to be created.

As I was typing this, it occurred to me that you would also create a new sources.xml in the Kids profile so you can control the sources to scan separately. Or you could use the option in advancedsettings for control of the scanning.

Once you get the databases setup, you will need to run a scan from each profile.

NThank you. That makes sense. I need to get over my fear of screwing something up. I have MySQL enabled on the host device, but when I restarted, I can’t add any media sources, or at least they don’t show up. I thought i remembered reading about the process of adding sources being screwy as it relates to MySQL. I tried to do it via NFS.

Adding sources is the same if you use MySQL or not. Are you using fstab based mounts, or Kodi based? I’d suggest using fstab based mounts.

If you always do your scanning from the main (host) system, then you don’t really have to add the sources to the clients. But for your sanity I’d suggest that you do, so if a scan is triggered from one of the clients it woun’t cause problems.

I’m not sure what fstab means but all our media is on NAS drives with nfo files providing the scraper data. I mapped the various folders by browsing via NFS but then nothing happens scan-wise.

Search the forum for help with setting up fstab.

You also need to set a content type for each source or they will not scan.

I set the content types just like I normally would which is why it surprised me. I also looked up fstab and that sounds interesting. I’ll give that a shot.

If it’s not scanning, we would need to see logs to try and figure out why.

My problems seem to be compounding. I was going to post a log but when I went to configure the wireless settings the MyOSMC app is unresponsive and I can’t get into the Internet settings. The issue with the sources is when I define what the media is and to use the local.nfo scraper and it asks if I want to refresh all items in its path, it reverts the sources back to “None” as if I never did any of the changes.

Your Kodi userdata may be corrupt. You may benefit from reinstalling OSMC if you have other issues, but we would need some more details.