Edgar Derby
Edgar Derby

Reputation: 2825

How to import data from local text file to mysql database

How can I load data to a MySQL server from a text file that is on my computer? I follow the procedure I found in this former question, but I think it is required for you to have the data file on your server. If I try, I receive an #1045 - Access denied for user 'learnsql'@'localhost' (using password: NO). I do not know if the two things are related.

I ran:

 LOAD DATA INFILE  'C:\Users\Me\Google Drive\dataset\userid-timestamp-artid-artname-traid-traname.tsv' INTO TABLE dataset 

Upvotes: 0

Views: 1398

Answers (1)

vidario
vidario

Reputation: 479

The "learnsql" user must have FILE privileges.

grant file on *.* to user@localhost identified by 'password';

And MySQL must have operating system access to files, of course.

Upvotes: 1

Related Questions