2013-07-25 69 views
-1
 
LINUX MYSQL C API 
MYSQL SERVER VERSION IS:5.1.9   
MYSQL CLIENT API VERSION:6.0.2 

錯誤是使用MySQL的LOAD DATA INFILE的相對路徑錯誤

Can't get stat of '/usr/local/mysql/var/NetCenter_Cache/FileCahce_HttpDown.Dat' (Errcode: 2),內容: LOAD DATA INFILE './NetCenter_Cache/FileCahce_HttpDown.Dat' INTO TABLE data_httpdown_2013-07-24 (probe_id , src_mac , dst_mac , src_ip , dst_ip , src_name , dst_name , dst_equip_type , dst_app_id , ip_version , ip_tunnel , src_port , dst_port , proto_type , proto_sub_type , operation , log_type , log_level , opstatus , rule_id , group_id , rulekeyword , domain , url , summary , content , file_name , log_time , str_time)

此路徑錯誤:

 
/usr/local/mysql/var/NetCenter_Cache/FileCahce_HttpDown.Dat 

我使用的是相對路徑

 
./NetCenter_Cache/FileCahce_HttpDown.Dat 

路徑指向

 
/usr/local/netaudit/NetCenter_Service/NetCenter_Release/NetCenter_Cache 

爲什麼改變?我有使用絕對路徑

回答

0

因爲LOAD DATA由服務器進程(不是客戶端)和MySQL守護進程當前目錄執行沒有問題

 
/usr/local/mysql/var/ 

因此使用絕對路徑到你的數據文件或如果由於某種原因(我無法想象任何),你希望它是相對的,然後從

 
`/usr/local/netaudit/NetCenter_Service/NetCenter_Release/` 

 
`/usr/local/mysql/var/` 

,而不是建立它

+0

是的,我想要使用相對路徑。 – user2289278

+0

你能解釋一下爲什麼嗎?它總是相對於'/ usr/local/mysql/var /'而不是你的應用程序文件夾 – peterm

+0

使用〜(home)文件夾的效果是什麼?/home/currentuser還是/ home/mysql? –