Kodi Community Forum

Full Version: Need help with MySQL asap due to reinstall
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I've had a weird OS crash on my Windows 2012 R2 KODI setup with MySQL and I need to reinstall. It appears I've been able to save all files however since I cannot boot up the original OS installation I cannot perform a clean SQL backup. So I basically need some tips ASAP so I can start reinstalling my OS, install KODI & MySQL - then hopefully reimport my database without having to redo everything. I've put a lot of effort into the database.

Brief info:
  • I used to have a single profile when I first setup MySQL
  • Later added a second profile ("Maria") which left me with "master user" + "maria" profiles on startup
  • It appears I have both MySQL 5.5 & MySQL 5.6 on the harddrive. Honestly don't recall why or if I upgraded at some point
  • When checking my programdata\MySQL\MySQL Server 5.5\data there is not much content, so apparently the 5.6 version was what I was using
  • programdata\MySQL\MySQL Server 5.6\data has a lot of folders, but I have no clue which ones are valid. I.e. on music I have "mymusic52", "mymusic56", "mastermusic52", "mariamusic52" & "mariamusic56"
  • I remember having some issues during upgrade to 16.0 I think, which I believe is what caused the multiple 52, 56 etc folders

So basically I would much, much appreciate if I could get some input on how to proceed after having reinstalled OS & setup KODI with MySQL again to get my old database imported - if possible. Here is a screenshot of my programdata\MySQL\MySQL Server 5.6\data folder:
https://s10.postimg.org/3ntzj7neh/mysql_...mbilde.jpg

All help appreciated. Badly want my KODI and server back up&running ASAP. Awaiting to see if I get some feedback here before reinstalling in case there is something I need to examine on the old OS harddrive before reformatting.

In advance, thank you!
In theory you should be able to do this:

- backup your complete data folder from the crashed drive to a safe place
- install the same (!) Kodi version you were running before the crash and the same MySQL version (the latest 5.6 should do it)
- configure your Kodi to use MySQL
- start Kodi ONCE: it should generate the folders 'myvideos99' and 'mymusic56' among others
- configure your Kodi profiles using the same profile names as before
- restart Kodi and after that stop both, Kodi and your new MySQL instance: the data folder should have your master and maria folders now
- rename the new MySQL data folder to somthing like 'data_new'
- copy your backedup data folder to your new target
- start the MySQL service
- take a look inside the instance with f.e. HeidiSQL: maybe you need to manually check indexes and the database itself
- try starting Kodi and: good luck!

And: keep your backup!
Hey Fry7, and thanks for the quick reply!

I was able to boot to command prompt, connected a USB harddrive and did a robocopy of the entire C:\ systemdrive of the crashed server. So I believe I should have all essential files including my old Kodi programfiles. However quite frankly I am not 100 % sure which Kodi version server was running: Where in the Kodi programfiles can I figure out the version ?

Having that said the procedure above seems fairly straight forward, although I have a few questions:
  • After renaming the new MySQL data folder til i.e. data_new and replace it with my old data folder, do I need to ensure the myvideos99 etc have the same names/numbering as the ones created in the data_new folder? I am no expert on this but to me it seems the numbering on these folders are quite random. And I assume once setting up Kodi with MySQL again, Kodi/MySQL would not be able to locate the databases unless numbering is the same as the numbers I get on my reinstall
  • In my old data folder, how can I tell which folder to import ? As mentioned in my first post I have 2 profiles, both with music set up, yet I have a total of 5 music folders in the old \data
  • You say it's important that I install the exact same version of Kodi and MySQL: MySQL is 5.6, and when I figure out which Kodi version I was on I'm sure I can install that version. But when I have to reinstall everything I also would like to be on the latest version of MySQL + Kodi. So to do so I should go ahead as you stated using same version of Kodi + MySQL then later upgrade them separately when I get Kodi working with my old databases & profiles?

Again appreciate the help. The entire house uses the server nonstop so I'm going insane having it down.
Concerning your desired Kodi version: database_versions (wiki)

So you need to install Kodi Jarvis 16.1.

Don't care about the numbering then as Kodi 16.1 will create and number the corresponding schematas itself.
The same Kodi will do after you've recreated your profiles (master and maria).

You might even just copy your secured old Kodi folder (%appdata%\Kodi) over to its new location and might give this a go.

Then simply copy the whole data folder as I suggested above, and hoping that the databases weren't corrupted too heavily (if at all) you might be able to run Kodi again.