This is how I recovered my databases from a HD crash using Mac OS X. These included both MyISAM and InnoDB tables.
- Get the files, typically from a backup or booting into your machine/server in recovery mode, usually located @ /var/lib/mysql
- Read (if you own this file) mysql_upgrade_info, so you see which mysql version created the files.
- Install the same version in your machine. If needed, uninstall whatever exists (if you don’t need it, of course):
brew remove mysql
- Install the closest mysql version to that you found in mysql_upgrade_info (or whatever you guess is the version). See the available formulas and do it:
brew search mysql
brew install mysql@5.5
- I installed myself version 5.5, which is the one I needed.
- Now locate the place where the local files reside, typically @ /usr/local/var/mysql
- Zip this folder as a backup measure and remove all of its contents.
- Move inside all the files and folders you got in step 1.
- Launch mysql:
/usr/local/opt/mysql@5.5/bin/mysql.server start
- Connect and mysqldump whatever you need.