Mysql
MySQL 導入 csv 文件 ERROR 13 (HY000): Can’t get stat of /path/file.csv (Errcode: 2)
我是 MySQL (5.5.34) / Linux (Ubuntu 12.04 LTS) 的絕對初學者`
我用一張表創建了一個簡單的數據庫。當嘗試通過 ‘data_test.csv 文件將數據導入其中時,會出現錯誤消息 13。
從終端執行如下:
mysql> source /home/g/stockrecdb/load_test.sql; Database changed ERROR 13 (HY000): Can't get stat of '/home/stockrecdb/data_test.csv' (Errcode: 2) mysql>
注意:如果在 LOAD DATA LOCAL INFILE 中使用 LOCAL 則會出現錯誤:ERROR 1148 (42000): The used command is not allowed with this MySQL version
我希望你正在使用
LOAD DATA INFILE
.嘗試使用
LOAD DATA LOCAL INFILE
而不是LOAD DATA INFILE
.其他問題可能是這個,請訪問以下連結:MySQL LOAD DATA。
當您登錄 MySQL 時,請執行以下操作,
abdul@xmpp3:~/Desktop/Jiva$ mysql -uroot -p --local-infile Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 257 Server version: 5.5.29-0ubuntu0.12.04.1-log (Ubuntu) Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use mydb; mysql> LOAD DATA LOCAL INFILE '/home/abdul/Desktop/STATISTIC_T.csv' INTO TABLE STATISTIC_T FIELDS TERMINATED BY '|' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES;
現在載入您的 CSV ,由於安全原因
LOAD DATA LOCAL INFILE
,我們需要--local-infile
在載入新的 MySQL 版本之前使用。CSV