Bug #70407 MySql data directories gets deleted after mysql server restart.
Submitted: 24 Sep 2013 12:22 Modified: 25 Sep 2013 6:25
Reporter: Vaibhav Srivastava Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.5.20 OS:Solaris
Assigned to: CPU Architecture:Any
Tags: file/db handling

[24 Sep 2013 12:22] Vaibhav Srivastava
Description:
After mysql restart I saw that mysql is not coming online with below error:

130913 16:20:48 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

Later I found that all the directories inside the mysql data directory (/opt/mysql/var/) is being deleted.

bash-3.2# ls -ltr /opt/mysql/var/
total 303822
-rw-r-----   1 root     root         152 Sep 13 18:31 mysql-bin.index
-rw-r-----   1 root     root        2049 Sep 13 18:31 atrcxb1313.err
-rw-r-----   1 root     root     2319738 Sep 13 18:31 mysql-bin.000001
-rw-r-----   1 root     root     18874368 Sep 13 18:31 ibdata1
-rw-r-----   1 root     root     67108864 Sep 13 18:31 ib_logfile0
-rw-r-----   1 root     root     67108864 Sep 13 18:31 ib_logfile1
-rw-r-----   1 root     root         107 Sep 13 18:31 mysql-bin.000002
-rw-r--r--   1 root     root       12175 Sep 13 18:31 atrcxb1313.err.old
-rw-r-----   1 root     root         107 Sep 13 18:31 mysql-bin.000003
-rw-r-----   1 root     root         107 Sep 13 18:31 mysql-bin.000004
-rw-r-----   1 root     root         107 Sep 13 18:31 mysql-bin.000005
-rw-r-----   1 root     root         107 Sep 13 18:31 mysql-bin.000006
-rw-r-----   1 root     root         107 Sep 13 18:31 mysql-bin.000007
-rw-r-----   1 root     root         107 Sep 13 18:31 mysql-bin.000008

As mysql data directories were mission, So we were unable to recover it.
When this scenario occurred  server was running with a high load on it.

How to repeat:
-We are not sure how can we reproduce this error again.

Suggested fix:
-None
[24 Sep 2013 12:40] Vaibhav Srivastava
svc.log.txt

Attachment: svc.log.txt (text/plain), 7.46 KiB.

[24 Sep 2013 14:04] Peter Laursen
I faced a similar problem on Windows some time ago.
http://bugs.mysql.com/bug.php?id=61826

.. but I don't remember details now.
[25 Sep 2013 6:25] MySQL Verification Team
Probably somebody deleted the datadir while mysqld was running and it was only noticed after the process quit.

mysqld does not automatically delete sub-directories when it shuts down or starts up.

I suggest you investigate who had access to the datadir and what they did.