How do I restore MySQL .frm .MYD .MYI files in OS X Lion [duplicate]

Possible Duplicate:
How to restore mysql database from the physical files?

I received a bunch of these types of files and haven’t a clue as how to restore the database on my Mac. I’ve found instructions on how to do this on Windows, that you simply need to put these into a specific directory and the database should be restored, but I don’t know which directory, or even where it would be located in OS X.

Someone mentioned that I take a look at the my.cnf file, but it’s empty. I also noticed that I had 2 mysql folders in usr/local/. I’ve uploaded a screen shot of the directory, as well as the opened cnf file at Screen Shot 1

Also, I opened up Sequel Pro (a MySQL client in case you’re not familiar with the application) and it successfully connects to the local MySQL database. Screen shot at Screen Shot 2

Any help would be greatly appreciated!

Answer

The default database directory should be /usr/local/mysql/var or /usr/local/mysql/data according to the docs (where /usr/local/mysql is just a symlink to the installed version). It would contain the “mysql” and “test” subdirectories for these two databases and the “ibdata1” storage file for InnoDB tables. You should just

  • stop mysql
  • create another subdirectory and name it like the database you need to restore
  • copy your FRM, MYD and MYI files there
  • restart mysql

to see the results. Note that this would only restore MyISAM tables, InnoDB tables may have had a different storage directory or have been stored within ibdata1 of the original server.

Attribution
Source : Link , Question Author : oliverkiss.com , Answer Author : the-wabbit

Leave a Comment