The MySQL Data Directory

After you start administering MySQL in anything but the most simple way, it becomes important to understand the structure of the MySQL data directory.

If you installed from a source distribution, this will be called var/ (such as /usr/local/mysql/var/), but if you installed a binary distribution, it will be called data/ (such as /usr/local/mysql/data/). There's no difference between the two, just the name, which has stayed different for historical reasons.

What's in the data directory? Not surprisingly, there's data, but there's a lot more besides.

Here's a sample directory listing:

# ls -l total 20888 -rw-rw---- 1 mysql mysql 25088 Aug 12 09:33 ib_arch_log_0000000000 -rw-rw---- 1 mysql mysql 5242880 Aug 24 14:00 ib_logfile0 ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.