could someone tell me what am i doing wrong?
that's what I type in MySQL shell
-> LOAD DATA INFILE C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\aavoc.csv
-> INTO TABLE googlecoursera.table1
-> FIELDS TERMINATED BY ','
-> ENCLOSED BY '"'
-> LINES TERMINATED BY '\r\n'
-> IGNORE 1 LINES;
and that's what I get
ERROR: Unknown command '\P'
ERROR: Unknown command '\M'
ERROR: Unknown command '\M'
ERROR: Unknown command '\U'
ERROR: Unknown command '\a'
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'C:rogramDataySQLySQL Server 8.0ploadsavoc.csv
LOAD DATA INFILE C:rogramDataySQLy' at line 1
CodePudding user response:
It might be / instead of \ for ':\ProgramData\MySQL\MySQL Server 8.0\Uploads\aavoc.csv'. Try using '/'
CodePudding user response:
Put quotes around the file name.
LOAD DATA INFILE 'C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\aavoc.csv'
INTO TABLE googlecoursera.table1
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;