anyongjin / mysql_ibd

import data from ibd files for mysql
MIT License
30 stars 5 forks source link

Thanks for you script tool to restore my data back, and share my way during some unclearly steps #5

Open Jir8taiwan opened 1 year ago

Jir8taiwan commented 1 year ago

My linux web server of wordpress is dead by accident in unknown reason. MySQL 8.2 is not able to service on and error log is not able to easily understand with a lot of bug codes. My backup has turned from 5.4 to 8.2 for three years, but I just know the new structure is not define the folder with only alone .ibd files inside. They cannot just copy the folder to another computer with mysql8 service to build, because cannot identify data structure originally. Until madness three days passing, the author's tool is my savior!! After series test and learn, I finally get back data in new reinstalled Mysql8.2 rebuilt configure in the end now. Thanks a lot.

I try to sort of them in steps. 1. git clone https://github.com/anyongjin/mysql_ibd.git 2. edit config.yml to define input old file, output new data (this one cannot work for me), temp save file, and new mysql server config. 3. run command to drive function: python main.py tosql 3.1 if python is missing packages as error message, it just calls pip install xxx to add the packages. 4. I do not know why, but I cannot call this command to load data into Mysql python main.py load_data 4.1 my alternative way is that goes to temp file, and open phpmyadmin or adminer to run the .sql file for input. 4.2 if new mysql server is causing error code 1067 due to empty date format, it can edit the .sql or command bypass function before loading. SET GLOBAL sql_mode = ”; 5. the .sql will create original structure of dictionary, but just empty data with .ibd files in the new folder. It stops mysql service first, and go overwiting to all original backup of .ibd files with existed data into the new folder. 6. It restarts mysql service first, and check any error or crash service in current status. it needs to manually execute several command lines for reload existed data back what structure has. ALTER TABLE existed-data1-name-to-call IMPORT TABLESPACE; ALTER TABLE existed-data2-name-to-call IMPORT TABLESPACE; ...etc it will update and reload all existed data back immediately. 7. If this data is back in another server of computer, this data should be able to use dump to copy all into a .sql file to reloading usage. mysqldump -u 'loginname' -p'loginpasswd' data-folder-name | tee /backup/liveDB.sql or mysqldump.exe -u 'loginname' -p'loginpasswd' data-folder-name > /backup/liveDB.sql (MySQL Workbench Server > Data Export)