程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MYSQL入門知識 >> mysql5.6 ignore-db-dir

mysql5.6 ignore-db-dir

編輯:MYSQL入門知識
 

通常我們都建議不要把mysql的datadir設置為文件系統的根目錄,否則,
show database的時候,會發現一個 奇怪的db: #mysql50#lost+found


mysql [localhost] {msandbox} (test) > SHOW DATABASES;
+---------------------+
| DATABASE |
+---------------------+
| information_schema |
| #mysql50#lost+found |
| mysql |
| performance_schema |
| test |
+---------------------+
5 ROWS IN SET (0.00 sec)

mysql [localhost] {msandbox} (test) > USE \#mysql50\#lost+found
DATABASE changed
mysql [localhost] {msandbox} (#mysql50#lost+found) >
mysql [localhost] {msandbox} (#mysql50#lost+found) > SHOW TABLES;
Empty SET (0.00 sec)
mysql [localhost] {msandbox} (#mysql50#lost+found) > DROP DATABASE \#mysql50\#lost+found;
ERROR 1064 (42000): You have an error IN your SQL syntax; CHECK the manual that corresponds TO your MySQL server version FOR the RIGHT syntax TO USE near '+found' at line 1
 

因為在根目錄中存在一個目錄,名為 lost+found,而它的名字又不符合mysql5的命名規范,所以就被附加了 #mysql50#在名字前面。

可以使用 ignore-db-dir (全部小寫) 來忽略它。
ignore-db-dir=lost+found
寫入my.cnf,重啟mysqld


mysql [localhost] {msandbox} ((NONE)) > SHOW DATABASES;
+--------------------+
| DATABASE |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 ROWS IN SET (0.00 sec)
 

如果有多個需要忽略的dir, 就重復多次這條opt:
ignore-db-dir=lost+found
ignore-db-dir=aaaa
ignore-db-dir=花容
 

 
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved