MySQL Data Files Missing? We are upgrading our website and I was checking on the size of the new database compared to the old one and was really surprised to find that in the /var/lib/mysql/ directory, the only files there were the .frm files. I searched the entire HDD for the .MYD files but the only ones are from the old database. It is on a CentOS 6.6 system running MySQL 5.5. 

Where would those files be located? At first I was worried that they might just be held in cache, and that if the server lost power all would be lost, but not so sure now.

Wow, awesome commands Rolando, here are the results which looks like the majority is not InnoDB, but I would have assumed it still would need to store the data in the same place, even if it was in a different format. Our old DB is 1.7GB when I use the du -h in the /var/lib/mysql and the directory I care about is less than 1MB

+----------------+----------------------+----------------------+----------------------+
| Storage Engine | Data Size            | Index Size           | Table Size           |
+----------------+----------------------+----------------------+----------------------+
| MEMORY         |             0.000 GB |             0.000 GB |             0.000 GB |
| InnoDB         |             0.151 GB |             0.059 GB |             0.210 GB |
| MyISAM         |             1.381 GB |             0.227 GB |             1.608 GB |
| Total          |             1.532 GB |             0.286 GB |             1.817 GB |
+----------------+----------------------+----------------------+----------------------+

+-----------------------+------------------------+
| VARIABLE_NAME         | VARIABLE_VALUE         |
+-----------------------+------------------------+
| INNODB_DATA_FILE_PATH | ibdata1:10M:autoextend |
| DATADIR               | /var/lib/mysql/        |
| INNODB_FILE_PER_TABLE | OFF                    |
+-----------------------+------------------------+
OK here is your situation: your INNODB_FILE_PER_TABLE is OFF.

The data and index pages for the InnoDB tables are all inside the system tablespace (ibdata1). For those tables, you only see the .frm files. Therefore, everything is OK.

Here is what InnoDB looks like (image courtesy of Percona CTO Vadim Tkachenko)



These days, many use the default innodb_file_per_table = 1. This used to be 0 for the default back in the days of MySQL 5.1. If you have innodb_file_per_table = 0 in your my.cnf, then MySQL is leaving all InnoDB tables inside ibdata1.

For more info on this, see my posts


Why does InnoDB store all databases in one file?
MySQL dynamically optimize innodb tables without &quot;file per table&quot; setting


You can leave the InnoDB tables inside ibdata1. If you want them stored outside, see the CAVEAT of my post How can I determine which Innodb table is being written?