Steps to find MySQL data location

kumkumsharma

Administrator
Staff member
Normally MySQL data will store in /var/lib/mysql, but still you want to check the the location of your database then you can follow below steps:

You can use below command to find the location of data directory:

Code:
mysql -e "show variables like 'datadir'"
You can get the directory for MySQL with above command, but you will get nothing in return then you can use default directory /var/lib/mysql.

Code:
grep datadir /etc/my.cnf
 
Top