Wednesday, 15 January 2014

Recover MySQL InnoDB data/structure from .frm (no .myd and .myi, ibdada, my.ini) files -



Recover MySQL InnoDB data/structure from .frm (no .myd and .myi, ibdada, my.ini) files -

i tried recover old innodb databases folder copied out of innodb defined tables. there no binary log file , my.ini file currently. not have ibdata log file @ hand. need able re-read table info can remake lost tables.

i losing foreign key relationships.

how can recover construction of such tables info goes unavailable log files?

some helping error messages when seek access such tables are:

1. can't find file: 'college_users' (errno: 2 - no such file or directory) 2. table 'college.college_batches' doesn't exist

to recover construction actor.frm file following:

create dummy table actor in database test(please note on 5.6 number of fields in false , original tables must match):

mysql> utilize test database changed mysql> create table actor(id int); query ok, 0 rows affected (0.01 sec)

for 5.6 create statement create table actor(id1 int, id2 int, id3 int, id4 int);. how know actual fields number in table. check error log next line:

2014-06-20 03:09:20 3741 [warning] innodb: table test/actor contains 1 user defined columns in innodb, 4 columns in mysql. please check information_schema.innodb_sys_columns , http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html how resolve

stop mysql

replace /var/lib/mysql/test/actor.frm actor.frm file:

cp /path/to/my/actor.frm `mysql -nbe"select @@datadir"`/test

start mysql innodb_force_recovery=6

# cat /etc/my.cnf ... [mysqld] innodb_force_recovery=6

on windows set "innodb_force_recovery=6" my.ini file under [mysqld] group.

start mysql

read construction of table actor:

mysql> show create table actor\g *************************** 1. row *************************** table: actor create table: create table `actor` ( `actor_id` smallint(5) unsigned not null auto_increment, `first_name` varchar(45) not null, `last_name` varchar(45) not null, `last_update` timestamp not null default current_timestamp on update current_timestamp, primary key (`actor_id`), key `idx_actor_last_name` (`last_name`) ) engine=innodb default charset=utf8

mysql innodb data-recovery

No comments:

Post a Comment