Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
Question about switching to SQLite to MySQL, and also about DB permissions
#1
Hello,

I'm looking to set up a second Kodi instance at home with a shared library / progress / etc. My media files are already shared over NFS from my NAS to my current Kodi instance. I have a couple of questions relating to using MySQL / MariaDB:

1. The wiki documentation instructs me to export everything in my library (NFO files) and then import again after switching to MySQL. But the current databases are all SQLite, and my cursory examination of the source code (C++ is not a language that I've ever worked with) makes it look like there's shared database code for either SQLite or MySQL. Is there a reason why I can't just dump the SQLite DBs and import the data into MySQL instead of having to do the export/import stuff?
2. For... reasons... I'd really like to run the database on a MariaDB server that I already have, but it contains some sensitive data and currently has permissions locked completely down per-DB. Aside from the wiki's "grant everything during install/upgrade and then lock down" (which isn't really feasible for me), is there any more concrete documentation on the permissions/grants needed? I know the wiki mentions triggers, though the only instance of "create trigger" that I see in the source code is a single trigger on the texture database.

Thanks for any assistance,
Jason
Reply
#2
1) We offer no direct SQLite->MySQL tools, so if you are confident enough to do this on your own, be our guest. I just hope that all tables/views/triggers can be transferred. The detour via nfo files is a proven way of transferring metadata.

2) As certainly not all Kodi users are (semi) professional database engineers, so the GRANT ALL option is a good enough starting point. Those who are more familiar with database of course can change the database user privileges, as indicated here: https://kodi.wiki/view/MySQL/Setting_up_...ess_rights
Reply
#3
(2021-03-25, 21:23)Klojum Wrote: 1) We offer no direct SQLite->MySQL tools, so if you are confident enough to do this on your own, be our guest. I just hope that all tables/views/triggers can be transferred. The detour via nfo files is a proven way of transferring metadata.

2) As certainly not all Kodi users are (semi) professional database engineers, so the GRANT ALL option is a good enough starting point. Those who are more familiar with database of course can change the database user privileges, as indicated here: https://kodi.wiki/view/MySQL/Setting_up_...ess_rights

Thank you so much, Klojum. I'll give the more complicated ways a try, post here with details if I succeed, and fall back to the documented, basic approach if that fails.
Reply
#4
If anyone happens by this thread, I came up with a working albeit awkward solution to this. The short version is:
  1. Stand up a temporary MySQL/MariaDB server, point Kodi at that to create the DBs and tables/views/triggers.
  2. Use a Python script to SELECT all rows from each SQLite database, and INSERT them into MySQL (no import/export needed).
  3. Dump the resulting database, and then import it on your actual/production server.
  4. Point all Kodi frontends at the new DB.
The full details, including a Python script for the data transfer, is on my blog at https://blog.jasonantman.com/2021/03/mig...ortexport/
Reply

Logout Mark Read Team Forum Stats Members Help
Question about switching to SQLite to MySQL, and also about DB permissions0