Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My development environment (Mac Lion) just got hosed after I rebooted my system today. I'm not sure what exactly happened, but it's almost as I'd reinstalled the server. My databases are gone and the users I'd set up are gone as well. There appears to be a possibly up-to-date backup of my mysql folder. /usr/local/ contains these:

lrwxr-xr-x   1 root  wheel     27 19 Nov 16:18 mysql -> mysql-5.5.18-osx10.6-x86_64
drwxr-xr-x  17 root  wheel    578 19 Nov 16:52 mysql-5.5.18-osx10.6-x86_64
drwxr-xr-x  11 root  wheel    374 15 Aug 23:02 mysql.bak

So, if I can, how do I restore from .bak?

Also, oddly, I'm unable to shut down my mysql. I've tried shutting it down with the Mac preferences pane and with mysqladmin and it automatically starts up again immediately.


The contents of the mysql.bak directory are:

drwxr-xr-x  41 root    wheel  1394  4 Mar  2010 bin
drwxr-xr-x   4 root    wheel   136  4 Mar  2010 docs
drwxr-xr-x   3 root    wheel   102  4 Mar  2010 include
drwxr-xr-x   3 root    wheel   102  4 Mar  2010 lib
drwxr-xr-x   4 root    wheel   136  4 Mar  2010 libexec
drwxr-xr-x  15 root    wheel   510  4 Mar  2010 mysql-test
drwxr-xr-x   5 root    wheel   170  4 Mar  2010 share
drwxr-xr-x  29 root    wheel   986  4 Mar  2010 sql-bench
drwx------  17 _mysql  wheel   578 19 Nov 16:20 var

This is similar (but not identical) to the active mysql directory:

-rw-r--r--   1 root    wheel  17987 14 Nov 08:47 COPYING
-rw-r--r--   1 root    wheel   7370 14 Nov 08:47 INSTALL-BINARY
-rw-r--r--   1 root    wheel   2552 14 Nov 08:47 README
drwxr-xr-x  46 root    wheel   1564 14 Nov 08:54 bin
drwxr-xr-x  39 _mysql  wheel   1326  9 Dec 01:39 data
drwxr-xr-x   6 root    wheel    204 14 Nov 08:54 docs
drwxr-xr-x  37 root    wheel   1258 14 Nov 08:54 include
drwxr-xr-x  12 root    wheel    408 19 Nov 16:19 lib
drwxr-xr-x   4 root    wheel    136 14 Nov 08:54 man
drwxr-xr-x  19 root    wheel    646 19 Nov 16:19 mysql-test
drwxr-xr-x   3 root    wheel    102 14 Nov 08:54 scripts
drwxr-xr-x  32 root    wheel   1088 14 Nov 08:54 share
drwxr-xr-x  28 root    wheel    952 14 Nov 08:54 sql-bench
drwxr-xr-x  16 root    wheel    544 14 Nov 08:54 support-files
drwxrwxrwt   4 root    wheel    136  8 Dec 23:18 var

And the version I'm using is mysql-5.5.18-osx10.6-x86_64.

share|improve this question
mysql.bak is a directory -- What are its contents? – voretaq7 Dec 8 '11 at 16:46
I've updated my question with the contents of both the active and ".bak" versions of mysql. I hope that helps. – Andrew Dec 8 '11 at 17:03
up vote 1 down vote accepted

mysql/data directory is the most likely place where your actual database is stored. I do not see mysql.bak/data directory from your listing, so that is not a good sign. A listing of mysql/data directory contents might be helpful.

On Linux, the default data directory is usually /var/lib/mysql/data. You might want to check if your database files might be located there.

You should also look in /etc/my.cnf to see what custom data directory might have been set up in there or if multiple MySQL instances are configured. If you can provide my.cnf contents, that might be helpful, just be sure to take out sensitive information like passwords from it.

I don't know Apple's Time Machine software that well, but maybe there is a chance that it took a backup of your database files?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.