To recover database from .frm
and contents from .ibd
You have to do following:
1) create temporary database to avoid suddenly working with other databases.
CREATE DATABASE soru_sor_recover;
2) generate CREATE TABLE
dumps from .frm
files (You'll need to install mysql-utilities
from here);
mysqlfrm –diagnostic answers.frm >> create_table.txt
mysqlfrm –diagnostic categories.frm >> create_table.txt
mysqlfrm –diagnostic inbox.frm >> create_table.txt
mysqlfrm –diagnostic questions.frm >> create_table.txt
mysqlfrm –diagnostic users.frm >> create_table.txt
3) import create_table.txt
using some gui or just by terminal:
mysql -u root -p soru_sor_recover < create_table.txx
4) now we have tables but they are empty. so we have to replace .ibd
file of empty tables with ibd files of recovery. so we need to discard tablespace:
ALTER TABLE answers DISCARD TABLESPACE;
ALTER TABLE categories DISCARD TABLESPACE;
ALTER TABLE inbox DISCARD TABLESPACE;
ALTER TABLE questions DISCARD TABLESPACE;
ALTER TABLE users DISCARD TABLESPACE;
5) replace .ibd
files in data folder and define user and group for that files:
cp *.ibd /var/lib/mysql/soru_sor_recover
chown -R mysql:mysql /var/lib/mysql/soru_sor_recover/*.ibd
6) restart mysql:
/etc/init.d/mysql restart
7) enable table spaces, go to mysql console:
ALTER TABLE answers IMPORT TABLESPACE;
ALTER TABLE categories IMPORT TABLESPACE;
ALTER TABLE inbox IMPORT TABLESPACE;
ALTER TABLE questions IMPORT TABLESPACE;
ALTER TABLE users IMPORT TABLESPACE;
original source of documenatation is here