Using LibreELEC on Pi4 to create Library on MySQL on another Pi

  • Hi All.

    I have run Kodi on a Rasperry Pi 1 for the past 8 years and this week have decided to replace it with a new 2GB Pi4.

    My media is stored on a Synology NAS (a DS210j originally and then, following a recent upgrade, a DS218+) and is accessed using NFS.

    Because the Kodi implementation I have used previously (OSMC) does not yet support Pi4 I have decided to move to LibreELEC, downloading the Pi4 image of 9.2.0. At the same time I thought I would also consider creating a central library using MySQL so that I can add more LibreELEC installations in future and run all from the same library.

    I do not consider myself to be an expert, but I am able to follow instructions without too much difficulty. I installed MySQL server onto another old Pi1 (also used for couple of other basic jobs) and have been able to test a remote connection from a Windows machine (the same machine I am using to type this) using an application called HeidiSQL to confirm that I could connect to the MySQL installation and that the username/password I had created for Kodi to use also worked.

    I then found on the Kodi Wiki how to create the file advancedsettings.xml and that this file should be placed in the .kodi/userdata folder. I also copied the sources.xml file from my old Kodi installation so that I did not need to create the media sources from scratch.

    In the LibreELEC settings (Network --> Advanced Network Settings) I have enabled "Wait for network before starting Kodi" and set the Maximum Wait Time value to 30 seconds (probably longer than needed even though I am using WiFi).

    My advancedsettings.xml file looks like this:-

    I restarted so that it could re-read the copied sources.xml file. With this all in place, I then went to Settings --> Media --> Videos... right-clicked on Movies source to configure the scraper settings. Once done, Kodi then prompts me to refresh the information. I select Yes and the system then proceeed to build the library.

    I then did the same for my TV media source and left the system to build that library.

    From a Kodi perspective the content is all present. I can select any entry from the library and it begins to play (I haven't tested a full programme/movie as my old Pi is still in place but from a basic playback perspective the new installation seems to be working).

    However, when I log into MySQL database and run "show databases;" there is no sign of the new database I would expect to find (just the 3 default databases).

    I can only assume therefore that the library has been created locally, but I am unsure why it has not connected to the MySQL server and created the library database there. I have looked at .kodi/temp/kodi.log and can find no references to 'mysql' or the IP address of the other Pi running MySQL to indicate an error.

    Can anyone advise if any of the steps I have carried our were not correct or let me know if there are any additional logs I can check (and where to find them) to see if I can find out if this LibreELEC/Kodi installation is even trying to connect to MySQL.

    Many thanks in advance.

    -Phil.

    • Official Post

    However, when I log into MySQL database and run "show databases;" there is no sign of the new database I would expect to find (just the 3 default databases).

    Which databases are present, and which database(s) were you expecting? Personally I'd use the DSM218 as the MySQL server. The Pi 1 is a terribly slow device, and SD cards are not that reliable with doing many rewrites.

    I can only assume therefore that the library has been created locally, but I am unsure why it has not connected to the MySQL server and created the library database there. I have looked at .kodi/temp/kodi.log and can find no references to 'mysql' or the IP address of the other Pi running MySQL to indicate an error.

    Provide the kodi log file via a pastebin website, e.g. connect via SSH to your Kodi device, and type pastekodi. Copy/paste the URL in your post so we can have a look.

  • Hi -

    Many thanks for your reply.

    In fairness I did consider installing MariaDB/MySQL on my DS218+, and I agree with your statement concerning the speed of the old model Pi, but thought that, once built, a Kodi library would be fairly static and would cause the old Pi too much stress.

    This was the original guide I found to setting up Kodi to use a MySQL back-end (though in this case it was a Windows installation of MySQL) - How to Sync Your Kodi Library Across Multiple Devices with MySQL - and it mentioned that once completed the database would be called something like "myvideosXXX" (where XXX was a 3-digit number). This was what I was looking for when running "SHOW DATABASES;" in MySQL. The only 3 databases are:-

    Code
    mysql> SHOW DATABASES;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    +--------------------+
    3 rows in set (0.01 sec)

    Here's the link to my logs, as requested:-

    Kodi Logs

    Many thanks again.

  • 2019-04-11 16:28:43.694 T:3011802448 ERROR: Error loading special://profile/advancedsettings.xml, Line 17 Error reading end tag.

    You f##'d up your advancedsettings.xml file ;)

    It won't load, and thus your mysql database connect won't be initialized.

    Fantastic!!! Thank you for spotting that.

    I had looked over the advancedsettings.xml file so many times I simply did not spot one incorrect character.

    I've amended my error, created a fresh LibreELEC build, copied over my (new) advancedsettings.xml and sources.xml files and have begun the process of creating a new library.

    As soon as the process started I then SSHd onto my Pi1 running MySQL connected to the service and ran "SHOW DATABASES;" again.

    This time I have two new databases :)

    Thank you again!

    I will now be able to see how the whole set-up performs (taking onboard your comment about the performance of MySQL on the old Pi1 - though it is only running a DNS service in addition to this) and may think about installing MariaDB on my DS218+

    If I do should I install v5 or v10?

  • Just to comment - MariaDB 10 works fine on a Synology for this set-up. I've got my database stored on my DS1019+ using it and a pair of LE Pi's and it has no issues at all. Install MariaDB 10 and phpMyAdmin packages and you're good to go.