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

MySQLMySQLi Database

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.

raja
Published on 21-Dec-2018 09:44:09
Advertisements