Where Are MySQL Files Stored in UNIX / Linux

Were are my MySQL database and table files are stored in UNIX or Linux operating systems?

Usually /var/lib/mysql or /var/db/mysql directory used to store database and tales under UNIX like operating systems.

You can use the following command to locate MySQL datadir:

grep datadir /etc/my.cnf

Sample outputs:

datadir=/var/lib/mysql

Another command that will display datadir:

ps -eo cmd,args | grep mysql

FreeBSD UNIX specific ps example:

ps -ao pid,command | grep mysql