mysqlimport – can’t get stat of file

So on my server here I have a process that ftps some data from a SQL server and loads it to MySQL. All was well until I got:
Can’t get stat of ‘/home/username/www/data’ (Errcode: 13)

I tried chmod and chown and running the file as root and everything. No success. I then found a post that said – move the file to /tmp. So I tried it and it worked! Here are my scripts.

Please note – you will have to add a user to mysql that has import permissions!

sql

truncate table equipment_in;

LOAD DATA INFILE ‘/tmp/equipment.csv’
REPLACE
INTO TABLE equipment_in
FIELDS TERMINATED BY ‘,’
OPTIONALLY ENCLOSED BY ‘”‘
LINES TERMINATED BY ‘\r\n’;

getdata

cd /tmp
rm *.csv*
wget ftp://username:password@servername/*.csv
mysql –user=username –password=thepassword databasename < /folder/with/the/sql

MySQL
MySQL Documents

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>