# 1. 登录 MySQL
mysql -u root -p
Enter password: ***
# 2. 输入下面命令
mysql> show global variables like "%datadir%";
+---------------+---------------------------------------------+
| Variable_name | Value |
+---------------+---------------------------------------------+
| datadir | C:\ProgramData\MySQL\MySQL Server 8.0\Data\ |
+---------------+---------------------------------------------+
1 row in set, 1 warning (0.12 sec)
mysql>