Server Fault is a question and answer site for system and network administrators. 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'm not a sys-admin, but sometimes I play one at work.

I've inherited a virtual server that had MySQL installed from source. I'm gathering as much information about the install as I can (original people who installed it are, of course, not a resource).

How can I find

  1. The default/current location of the MySQL binary files (often stored in a directory named data?)

  2. Any default or custom loaded cnf files?

Looking for solutions that are a bit more sophisticated than a find / -iname '*.cnf' :)

share|improve this question
up vote 1 down vote accepted

When compiling from source, /usr/local is the default prefix. Some people like to use the standard system-wide locations, such as /usr, instead even though it could be argued that it breaks the hierarchy standards.

MySQL's default directory to store all variable files such as configuration and databases is data. The default system-wide configuration file is my.cnf.

Ultimately, short of searching the filesystem, would be to look at the process list (ps aufx) and see where MySQL is running from, as the parameters MySQL is started with would identify its location.

share|improve this answer
Good info, thanks. Getting a process list netted me the data directory (/usr/local/mysql/var), but it looks like there are only sample/test cnf files in the /usr/local/mysql and none was provided for in the process list. Any tips for ferretting that that? (and is a cnf file required? Will MySQL load with default values if one isn't configured?) – Alan Storm Apr 7 '10 at 18:02
MySQL will load with default values if no cnf is located, yes. Unless specified otherwise, it will load the cnf from the data directory. I'd still recommend searching the filesystem for all instances of the .cnf. You can show the running configuration by running show variables; within the client. – Warner Apr 7 '10 at 18:28

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.