4

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 ...

Community
  • 1
  • 1
metoo
  • 67
  • 1
  • 2
  • 9
  • 2
    Not a duplicate of the question it's marked as a dupe of; the other question asks how to recover a table from the raw files, and this one specifically asks about if (some of) those files are missing. The other question's answers do not apply. – cHao Nov 14 '12 at 02:22

1 Answers1

8

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.

cHao
  • 84,970
  • 20
  • 145
  • 172
  • Many thanks, cHao - also for putting them right regarding the 'alleged 'dupe' question. I do have existing innoDB tables so ill try your suggestion regarding dumping the files in a new directory ... etc May i ask though, how do i point MySQL to that new directory?? – metoo Nov 14 '12 at 13:02
  • You could probably say `mysqld --datadir=/path/to/files`, if you stop the running mysqld. If you leave it running, there are more options you'll have to set. – cHao Nov 14 '12 at 13:19
  • hi cHao - It keeps giving me errors mainly syntax i believe - i'm going to go about it the long method and open the .frm files and use any salvageable info within to create the tables again. I only need to know the field-names 'cos fortunately of the 19 tables in the db only 5 'yet unused' tables are missing. Hey, thanks again for your time & support. – metoo Nov 14 '12 at 16:14