Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. 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

I was wondering why do we deploy data files under /var/lib/mysql/. Is there a logical reason for that, or is that just a "traditional" place for the data?

I will value more answers based on standards like the LSB or the POSIX, and would appreciate links to the policies of your favourite Linux or Unix implementation that dictate this is the expected place to deploy your data.

Many thanks in advance for your attention and answers.

Kind regards,

-- LMC

share|improve this question
up vote 2 down vote accepted

In the Filesystem Hierarchy Standard, /var/lib is listed as containing:

State information. Persistent data modified by programs as they run, e.g., databases, packaging system metadata, etc.

So it is very much because it is the traditional/documented place to put such things. If a database system or similar is installed under /opt it is common for the data files to also be under /opt, though many would argue that /var/lib is still the right default location in that case (with state pertaining to the running of the app in /opt and state/data produced or consumed by the app (such as user databases) under /var/lib).

Of course on a multi-user system, keeping user databases under /home/<user> often makes more sense, though not all database engines support this (or don't support it easily, without some manual jiggery-pokery on the part of your SysAdmin/DBA).

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.