Error in importing Large Dataset using My SQL Workbench intogroup azure batabase

56 views Asked by At

I'm fairly knew to using SQL. I'm trying to load in my dataset (about 12.1K rows, 6000kB) into a table using workbench, but I get this error:

Error Code: 1045. Access denied for user '[my_username]'@'%' (using password: YES)

If anyone can help that would be much appreciated. (also please let me know if there's anything wrong with the code itself)

The Import Data Wizard tool won't work as it only loaded in half the rows. I've been trying to load it in Load data infile but I keep getting an error and have no clue how to resolve it. I already created an empty table with the columns and datatypes.

LOAD DATA INFILE 'C:\Users\natal\Documents\Masters\Cuny SPS MDS\Spring 2024\Data 607\week 8\job_postings_revised.csv' INTO TABLE job_postings
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES

Also to note, I am trying to load this dataset into my class' shared azure database, which ive been given a password and username too. I'm not sure if that is the issue.

1

There are 1 answers

0
Balaji On

Error Code: 1045. Access denied for user '[my_username]'@'%' (using password: YES)

The above error causes due to a 'user'@'localhost' doesn't have the file privilege. You can give that privilege by using the below command.

GRANT FILE on *.* to user@'localhost'

After granting the file privilege, try with the below query to import .csv from local to Azure MySQL database.

LOAD DATA INFILE 'C:\\Users\\******\\Desktop\\MyTrails\\sampleFile.csv' INTO TABLE Table1
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
  • For more information, refer to this link.