Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How can I load my file successfully with Load Data Local File on mysql workbench

ID: 3595537 • Letter: H

Question

How can I load my file successfully with Load Data Local File on mysql workbench, I keep getting an error. Error # 2

3e MySQL Workbench Local instance 3306 File Edit View Query Database Server Tools Scripting Help MANAGEMENT 2tbX Server Status Client Connections Users and Privileges Status and System Variable Data Export Data Import/Restore elderly int NULL 14 15 L) 17.SELECTFROM tb 18 19 LOAD DATA LOCAL INFILE 20 21 INSTANCE ·/home/1t17064591/Downloads/tb.csv' INTO TABLE tb FIELDS TERMINATED BY' ENCLOSED BY B Startup /Shutdown Server Logs Options File 23 LINES TERMINATED BY 'n 24 (country, year, sex, @child, @adult, @elderly) 25 PERFORMANCE SET Performance Reports Performance Schema Setup Filter Rows: a country year sex child adult elderly Result Grid Export: ] Wrap Cell Content: e SCHEMAS Q Filter objects flights 0 Read Only Pstudents Action Output Tables Views Stored Procedures Action Duration / Fetch 0.0049 sec 0.0092 sec 0.0034 sec0.0000... Message 0 row(s) affected Time 1 19:02:34DROP TABLE IF EXISTS t 2 19:02:34 CREATE TABLE tb country varchar 100) NOT NULL, year i... O row(s) affected 3 19:02:34SELECT FROM tb LIMIT 0, 1000 0 row(s) returned VideoReviews 4 19:02:34 LOAD DATA LOCAL INFILE 'yhomelt17004591/Downloads/tb.cs.. Error Code: 2. File 'home/lt17004591/Downloads/tb... 0.00030 sec - Query interrupted

Explanation / Answer

The possible cause and the resolution of the error could be as follows:

The given file name should be one literal string. In your case, you have given it that way.

However, the LOCAL keyword in the command will affect the location where the file is expected to be found:

If LOCAL is specified, like in your case, the file is read by the client program on the host of the client and then is sent to the server. The exact location of the file can be given as a full path name. But, if given as a relative path name, not the full one, the command understands relative to the directory in which the client program was started.

Try removing local, and changing the forward slash to backslash and double backslash and see what happens.

Note: In case there is doubt/futher question, kindly do not not hesitate to ask me in the comments. Thank you!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote