我绝对是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,则会出现错误:
错误1148(42000):此MySQL版本不允许使用该命令
解决方法:
我希望你使用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;
现在使用LOAD DATA LOCAL INFILE加载CSV,出于安全原因,我们需要在新的MySQL版本中加载CSV之前使用–local-infile.