13

I'm trying to recover a table in a MySQL database from Time Machine, however I don't know and can't find where Leopard Server's MySQL stores its data files.

  1. Does anyone know where they are stored?
  2. Is there an easy way to run mysqldump on them without restoring them?
  3. Is there anything else I should know about Time Machine and MySQL data file(s)?
pixelcort
  • 249
  • 3
  • 15

3 Answers3

28

Connect to the database and issue

SHOW VARIABLES LIKE 'datadir';

Which will tell you the right answer even if it's been changed from the default.

MarkR
  • 62,604
  • 14
  • 116
  • 151
12

For my standard install (from a package) it was located in

/usr/local/mysql/data
nevan king
  • 112,709
  • 45
  • 203
  • 241
  • Note that `/usr/local/mysql` is a symlink, for example to `/usr/local/mysql-5.6.20-osx10.8-x86_64`. When you install a new version of MySQL, a new folder is created to which the `/usr/local/mysql` symlink will point. Yu have to move the old data directory to this new folder yourself. – Benedikt Köppel Sep 15 '14 at 18:30
0

It's in /var/mysql/dbname , where dbname is the name of the database.

pixelcort
  • 249
  • 3
  • 15