In order to know the location of MySQL table data, you can use the below syntax −
select @@datadir;
You can also use SHOW VARIABLES command for this. Following is the syntax −
show variables where Variable_name ='datadir';
Let us implement the above syntaxes to know where MySQL table stores data −
mysql> select @@datadir;
This will produce the following output −
+---------------------------------------------+ | @@datadir | +---------------------------------------------+ | C:\ProgramData\MySQL\MySQL Server 8.0\Data\ | +---------------------------------------------+ 1 row in set (0.00 sec)
Here is the alternate query to know where MySQL table data stored −
mysql> show variables where Variable_name ='datadir';
This will produce the following output −
+---------------+---------------------------------------------+ | Variable_name | Value | +---------------+---------------------------------------------+ | datadir | C:\ProgramData\MySQL\MySQL Server 8.0\Data\ | +---------------+---------------------------------------------+ 1 row in set (0.23 sec)
Now follow the above path to reach where MySQL table is stored. Following is the screenshot displaying the location for tables −