开发者

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.


  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


as error shows, you should double check if user-password-host-db combination is correct. this is what the error tells you.


Make sure you are allowed to log into the database as root and you have the correct password in your connect string (caspian)

Connection conn = db.connect("jdbc:mysql://localhost:3306/test","root","caspian");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜