Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to restore my MYI, MYD tables from .FRM [duplicate]

Possible Duplicate:
How to recover mysql db from .myd, .myi, .frm files

I have seen this question on here but to be honest cannot understand any of the solutions posted. I've just reinstalled windows vista following some problems and i DID make a copy of the entire 'data' folder for the old installation of Mysql. The original and newly installed version of MySQL was, 5.0.85.

The original version of phpMyAdmin was, 3.2.1 but ive now installed the latest vers: 3.5.3. Problem is i've lost some MYI and MYD files which i believe are the tables and index files. All the .FRM files are present and a, ibdata1 file (also, ib_logfile0 and ib_logfile2).

The tables show up in phpMyAdmin in some screens such as the 'assign table level priviledges' drop down menu - so they seem to be still there but they dont show up in the left column which shows all tables in aDB. are they recoverable or lost for good?? I would appreciate any help in enough detail to understand for a newbie. I've setup WAMP before but never run into this issue.

with thanks in advance ...

like image 691
metoo Avatar asked Feb 19 '23 12:02

metoo


1 Answers

The .frm files just contain metadata about the structure of the table. They don't contain your data.

For a MyISAM table, the .MYD file is basically the table (sans metadata or indexes); if it's gone, your data's gone. There's probably a way to generate "empty" files and start over, but yeah. Without them, you have no data.

The .MYI files contain indexes, AFAIK. Those can be regenerated, but not without the data.

If your tables were InnoDB tables, though, you might be in luck. There won't be a .MYD or .MYI for InnoDB tables; the data that would have been in them will instead be in ibdata1. You might be able (after stopping mysqld) to simply sneak the .frm and ib* files into the correct positions and let mysqld see them when it restarts.

Of course, this won't work if you already have InnoDB data files -- or rather, if it does, you'll end up losing any existing InnoDB tables. In that case, though, you could put the files into another directory and start a mysqld instance pointing at that directory. That would be enough for you to mysqldump a table as SQL, so you can import it into the new database.

like image 51
cHao Avatar answered Feb 22 '23 01:02

cHao