ERROR 13 (HY000): Can't get stat of

Following on from my tip this  week about Exporting from SQLite to csv. This is a follow on as I had this when I was trying to import the data into a MySQL table.

Once I had the file, I logged into the database and tried the import

MariaDB [databases]> load data infile '/tmp/databases.csv'
    -> into table main_db
    -> fields terminated by ',';

Once I tried the import I got the following:

ERROR 13 (HY000): Can't get stat of '/tmp/databases.csv' (Errcode: 2)

All the permissions were ok to the file, etc so that wasn't the issue, always best to check first.  To overcome this error, I changed the import to the one below, I added the word local, then the import worked as you can see

MariaDB [databases]> load data local infile '/tmp/databases.csv' into table main_db fields terminated by ',';

Query OK, 78 rows affected (0.00 sec)
Records: 78  Deleted: 0  Skipped: 0  Warnings: 0

So to overcome this, the one simple word local sorted out this issue, hope this helps you out.

I am always interested in feedback so please feel free to add any comments, or you can mail me  here.  If you would like to submit a quick tip  with full credit and links back to your site then also feel free to contact me.

Related Posts Plugin for WordPress, Blogger...

MySQL - Cant see all the data in the columns

Export to csv file from SQLite