Restore Database MySQL from ibd/frm File

From TKJOnline Wiki
Jump to: navigation, search

Just do with this :

  • Drop the table from the mysql server
mysql> drop table dbname.tblname;
  • Create a table with similar structure with mysqlfrm
mysqlfrm --diagnostic /srv/na/backupmysql-130817/mysql/dbname/tblname.frm > /tmp/dbname.tblname.sql
mysql -u root -p dbname < /tmp/dbname.tblname.sql
  • alter table discard tablespace
mysql> alter table dbname.tblname discard tablespace;
  • Move the cfg and ibd files into the data directory(that you have copied from another server)
rsync -av --progress /srv/na/backupmysql-130817/mysql/dbname/tblname.ibd /var/lib/mysql/dbname/
  • Alter table import tablespace
mysql> alter table dbname.tblname import tablespace;