Have you ever spent a lot of time trying to locate where MySQL keeps some file? Here is a quick way to find all this information in one place.
The obvious way is through examining database options in my.cnf or looking at the output of SHOW GLOBAL VARIABLES. But not every path may be explicitly set in the configuration, in such case MySQL may assume some default, while other options may be set using relative paths.
A different approach is listing all files that a running database instance keeps open and searching for the required information there. I find that method by far the fastest whenever I need to learn any of such details.
garfield ~ # lsof -nc mysqld | grep -vE '(\.so(\..*)?$|\.frm|\.MY?|\.ibd|ib_logfile|ibdata|TCP)' COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 30257[Read more...]