1

Gone through the below link also but i am unable to import CSV file in mysql. Even i had tried by using > LOAD DATA LOCAL INFILE but same error persisting. Please help me in this. queries i tried had appended below

MySQL import csv only gets half the lines

mysql> LOAD DATA INFILE 'home/karthick.g.s/Desktop/karthick.csv'
    -> INTO TABLE test_1
    -> FIELDS TERMINATED BY ','
    -> ENCLOSED BY '^' 
    -> LINES TERMINATED BY '\r\n';
ERROR 13 (HY000): Can't get stat of '/var/lib/mysql/home/karthick.g.s/Desktop/karthick.csv' (Errcode: 2)
mysql> LOAD DATA LOCAL INFILE 'home/karthick.g.s/Desktop/karthick.csv'
    -> INTO TABLE test_1
    -> FIELDS TERMINATED BY ','
    -> ENCLOSED BY '^'
    -> LINES TERMINATED BY '\r\n';
ERROR 1148 (42000): The used command is not allowed with this MySQL version

I am using the version 5.5.37-0ubuntu0.12.04.1

Karthick
  • 1,197
  • 9
  • 25
  • http://dba.stackexchange.com/questions/55960/mysql-import-csv-file-error-13-hy000-cant-get-stat-of-path-file-csv-errcod – stacylaray Jul 19 '14 at 08:04
  • @stacylaray attached link has mentioned to use LOAD DATA LOCAL INFILE i had tried that also please check my second query... – Karthick Jul 19 '14 at 08:48

1 Answers1

2

From the manual here, you could try experimenting with your my.cnf settings - I know that I had this problem in the past and I eventually got around this by using [client] setting.

# added from http://dev.mysql.com/doc/refman/5.6/en/load-data-local.html
# to allow for abrowse to load data!
loose-local-infile  =   1

local-infile    = 1 

Now, it was either local-infile or loose-local-infile which worked eventually. I believe that loose-local-infile is the more permissive setting, so you could try that first - and if you've no security concerns on your server, you could leave it at that.

Vérace
  • 29,825
  • 9
  • 70
  • 84
  • This issue goes way back to 2002 : http://lists.mysql.com/mysql/115782. Your answer fits here. Using [mysql] group header would probably be more applicable if other client tools do no recognize local-infile. +1 !!! – RolandoMySQLDBA Jul 20 '14 at 01:43