
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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.
- Related Articles
- How can we return to windows command shell from MySQL command line tool?
- MySQL command line client for Windows?
- How to repair MySQL tables from the command line?
- How to upgrade MySQL server from command line?
- Connecting to MySQL database from the command line?
- Connect to MySQL database from command line
- How to see spaces in data when selecting with MySQL command line client?
- The MySQL Command-Line Client
- How to run TestNG from command line?
- How to display records vertically in MySQL command line?
- How to list databases vertically in MySQL command line?
- How to open MySQL command line on Windows10?
- Where is MySQL bin directory located in Windows OS?
- How to run Python functions from command line?
- How to call Python module from command line?

Advertisements