Find 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: 2019-07-30T22:30:24+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements