Search code examples
mysqlload-data-infilesqlexception

mysql exception while importing csv file to mysql database


i would like to import csv file in mysql database.

my query would be like the following.

query = "LOAD DATA INFILE '"+filename+"' INTO TABLE testtable FIELDS TERMINATED BY ',' (text,price)";

But i got the following error while importing file.

java.sql.SQLException: Access denied for user 'root'@'%' (using password: YES)

for full source code you can see http://www.javalobby.org/java/forums/t53674.html.

Any Help is greatly appriciated.

Thanks.


Solution

    1. the user you are using does not have the privileges to load data
    2. you might also need to specify LOAD DATA LOCAL
    3. make use user root allowed to access other than from localhost