MySQL 儲存資料庫檔案的位置


要了解 MySQL 儲存資料庫檔案的位置,可以使用 @@datadir 變數。查詢如下 −

mysql> select @@datadir;

以下是顯示路徑的輸出 −

+---------------------------------------------+
| @@datadir                                   |
+---------------------------------------------+
| C:\ProgramData\MySQL\MySQL Server 8.0\Data\ |
+---------------------------------------------+
1 row in set (0.00 sec)

以下快照展示了 MySQL 儲存資料庫檔案的位置,即我們上面得到的那條路徑 −

現在,讓我們使用 SHOW 命令驗證上述資料庫是否存在。

查詢如下 −

mysql> SHOW DATABASES;

以下是輸出 −

+--------------------+
| Database           |
+--------------------+
| business           |
| database1          |
| databasesample     |
| education          |
| hello              |
| information_schema |
| javadatabase2      |
| javasampledatabase |
| mybusiness         |
| mydatabase         |
| mysql              |
| performance_schema |
| sample             |
| sampledatabase     |
| schemasample       |
| sys                |
| test               |
| test3              |
| universitydatabase |
+--------------------+
19 rows in set (0.12 sec)

檢視上述輸出,所有資料庫都匹配。

更新時間:2019 年 7 月 30 日

2K+ 次瀏覽

開啟您的 職業

完成課程,獲得認證

開始
廣告