Results 1 to 2 of 2
Thread: Mysql 'LOAD DATA INFILE' command line issues
-
Mysql 'LOAD DATA INFILE' command line issues
17 Feb 2012 @ 08.38 Hi guys, I have a stupidly large csv I need to import into a database, I've done this before and it's worked fine, but today it's just not, which is odd as I don't think I'm doing anything different.
I've FTP'd the csv up to the server, navigated to the folder with the 'myfile.csv' file in it and started mysql as the user with access to that db and run:
It worked perfectly when I did this last year, but today I'm getting the error:Code:LOAD DATA INFILE 'myfile.csv' INTO TABLE mytable FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
I tried just a simpler version of the command;Code:ERROR 1045 (28000): Access denied for user 'myuser'@'%' (using password: YES)
But this gives the same error, I'm not too tip-top on command line sql-ing, so any tips would be greatly appreciated. I tried logging in as root to do this, but it looks like there isn't a root user in the mysql table (not sure if that's right, as I can log in as root if I disable passwords), but then running the same command (as root) I get new errors:Code:LOAD DATA INFILE 'myfile.csv' INTO TABLE mytable;
I thought it should look in the directory I'm currently in on the server (it did that last time), so I tried setting the directory of the file in the mysql command to see if it'd look there:Code:ERROR 29 (HY000): File '/var/lib/mysql/mydatabase/myfile.csv' not found (Errcode: 2)
And I get this error:Code:mysql> LOAD DATA INFILE '/var/www/vhosts/mydomain.com/httpdocs/uploaded/myfile.csv' INTO TABLE mytable;
Any suggestions or hints as to where I'm going wrong?Code:ERROR 13 (HY000): Can't get stat of '/var/www/vhosts/mydomain.com/httpdocs/uploaded/myfile.csv' (Errcode: 13)
Thanks,
Stu
-
17 Feb 2012 @ 09.33 the last error is due to a rights problem. the MySQL user can't access the file where it is currently stored, either change the rights or move the file to a directory where the MySQL user can access it.



LinkBack URL
About LinkBacks












IMAGE LINKING..Can View...
Thanks Mike.... I will give it a try..