Take the 2-minute tour ×
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. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.