Search code examples
mysqlload-data-infile

MySQL LOAD DATA Error can't resolve...!


mysql> LOAD DATA INFILE '/abc.txt' INTO TABLE test1 FIELDS TERMINATED BY '|';
ERROR 13 (HY000): Can't get stat of '/abc.txt' (Errcode: 2)

I used LOAD DATA as per the syntax. But getting the above error. can anybody tell what is the error..!? I tried searching google dev.mysql can't find what error it is??

Thanks in advance


Solution

  • If the file is on your MYSQL server try using the full path.

    LOAD DATA INFILE '/var/tmp/abc.txt' INTO TABLE test1 FIELDS TERMINATED BY '|';
    

    If the file isn't on the server and it is on your local machine, and your user has access to SCP files between the servers ( try this

    scp abc.txt mysqlserver: 
    

    ) then you should be able to do this (using full path again) ..

    LOAD DATA LOCAL INFILE '/var/tmp/abc.txt' INTO TABLE test1 FIELDS TERMINATED BY '|';
    

    If that doesn't work.. try renaming the file to test1.txt and using the 'mysqlimport' command?