MySQL MariaDB

How to Find Data Directory Location in MySQL on Windows Machine

Data directory is the directory created at the time of MySQL installation to store the information about MySQL server, such as System Schema, Performance Schema, and Server Logs. Sometimes you need to locate the data directory to find the source of specific data and its duplicate data in the distributed database environment.

This guide will provide methods to:

Method 1: Find Data Directory Location in MySQL on Windows Using Command Prompt

To find data directory location on Windows, open the Command Prompt:

Connect the MySQL server using the syntax:

mysql -u root -p

Provide the username of MySQL server and hit “Enter”. It will ask for the password, type the password and hit “Enter”, and you will log into the MySQL server successfully:

To find the data directory location, run this command:

SHOW VARIABLES LIKE 'datadir';

The output will provide the complete location of the data directory, copy the location:

Paste this location in the address bar and hit “Enter”, it will open the data directory:

You have successfully found the data directory location using the command prompt on Windows.

Method 2: Find Data Directory Location in MySQL on Windows Using MySQL Workbench

To find data directory location using the MySQL Workbench (GUI Tool), open the workbench by searching “MySQL Workbench” in the Start menu:

Click on your database available under the heading “MySQL Connections”, provide the password, and click on the “OK” button:

Click on the “Server” to open the list. From the list click on “Server Status”:

In the “Server Directories” heading, locate the “Data Directory”. You can copy this location to browse for the data directory:

You have successfully found the data directory location using the MySQL Workbench in Windows.

Conclusion

To find the location of the data directory in Windows through the command prompt and MySQL Workbench. Run the command “SHOW VARIABLES LIKE ‘datadir’;” to find the data directory. In the MySQL workbench, click on “Server Status” and locate “Data Directory”. This guide demonstrated methods for finding the location of the data directory in MySQL on Windows.

About the author

Abdul Mannan

I am curious about technology and writing and exploring it is my passion. I am interested in learning new skills and improving my knowledge and I hold a bachelor's degree in computer science.