1

Someone has given me a copy of a database full of FRM, MYD, and MYI files. Trying to open it in my newer MySQL version gives an error that I need to run mysql_upgrade. I don't want to change the files at all, so I want to install the same version of MySQL that was used to create the database. Is there some way to identify the creation version from looking at these files?

4
  • You might be able to run it with the --upgrade-system-tables option. This should leave the user-defined schemas alone. Please see here: dev.mysql.com/doc/refman/5.7/en/mysql-upgrade.html Always back up the original files first before you run something and you can always restore from the backups if what you try doesn't work.
    – raphael75
    Commented Aug 1, 2019 at 19:48
  • Also, check here: stackoverflow.com/questions/879176/…
    – raphael75
    Commented Aug 1, 2019 at 19:52
  • @raphael75 - That sounds backwards. The frm/myd/myi files in the database probably need fixing, not the system tables.
    – Rick James
    Commented Aug 1, 2019 at 22:00
  • Do you have the mysql schema (user.MYD, user.MYI, ...) ??? Commented Aug 2, 2019 at 13:56

1 Answer 1

4

Open the .frm file with a hex editor. Go to offset 0x33 and read four bytes. Convert to decimal, keeping your endianness in mind.

Examples:

  • c0c30000 --> c3c0 --> 50112 --> version 5.1.12
  • 64c50000 --> c564 --> 50532 --> version 5.5.32
  • b2860100 --> 186b2 --> 100018 --> version 10.0.18 (MariaDB)
  • 19870100 --> 18719 --> 100121 --> version 10.1.21 (MariaDB)

Sources:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.