Page 1 of 1

Using mysqlfrm against XAMPP installed mySQL

PostPosted: 31. July 2019 14:54
by iwildman
Has anyone every got mysqlfrm to work when spawning a mysql process via mysqlfrm when mysql was installed via xampp?

Re: Using mysqlfrm against XAMPP installed mySQL

PostPosted: 04. November 2021 19:07
by ralplpcr
I have - - and it does require some patience to make it work.
The trick is to use the "--diagnostic" flag. The output does show a warning, but the SQL code itself does function.

Example: Let's say you have a database named "mydata", with 2 INNODB tables: "stuff" and "address". You'll have to run mysqlfrm for each table:
Code: Select all
mysqlfrm --diagnostic "C:\backup_copy\mydata\stuff.frm" > "C:\to_restore\mydata\stuff.sql"

mysqlfrm --diagnostic "C:\backup_copy\mydata\address.frm" > "C:\to_restore\mydata\address.sql"


You can then go through the painful process of creating the database and then importing each .SQL file into it.
Code: Select all
mysql -u root --password=<yourpassword>
create database `mydata`;
exit

mysql -u root --password=<yourpassword> mydata < "C:\to_restore\mydata\stuff.sql"

mysql -u root --password=<yourpassword> mydata < "C:\to_restore\mydata\address.sql"


Once you're done with that, you have to apply the following command to each table:
Code: Select all
ALTER TABLE `mydata`.`stuff` DISCARD TABLESPACE;
ALTER TABLE `mydata`.`address` DISCARD TABLESPACE;

This should remove the .IBD files from the C:\xampp\mysql\data\mydata\ directory.
You would then copy the "good" .IBD files into their spot.
Once they're copied over, you need to re-activate the INNODB link:
Code: Select all
ALTER TABLE `mydata`.`stuff` IMPORT TABLESPACE;
ALTER TABLE `mydata`.`address` IMPORT TABLESPACE;


That should be it! The data in your copied .IBD files should now be active within your INNODB tables. :)