How to find the MySQL data directory from command line in Windows?


To find the MySQL data directory, we can simply use the variable datadir. Let us see how to use the variable with select statement.

The query is as follows −

mysql> select @@datadir;

Here is the output

+---------------------------------------------+
| @@datadir                                   |
+---------------------------------------------+
| C:\ProgramData\MySQL\MySQL Server 8.0\Data\ |
+---------------------------------------------+
1 row in set (0.00 sec)

Now we can reach the directory from the above sample output.

Here is the snapshot that displays the MySQL data directory.

Updated on: 30-Jul-2019

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements