If you are a MySQL user, its most likely that you would have come across a need for importing the data in the Excel or CSV files directly to you MySQL tables. The ‘LOAD DATA LOCAL INFILE’ command supported by MySQL can help you to achieve your purpose. Below is the syntax for using this command,
LOAD DATA LOCAL INFILE ‘C:\\test\\userData.csv’ INTO TABLE User FIELDS TERMINATED BY ‘,’ (name,email,address)
In the above command, I am inserting the data into three of the columns in the ‘User’ table directly from the ‘userData.csv’ file. If you have the data in an Excel file, you need to convert it to a CSV file before using this command. Also, make sure you don’t have any column headers in the file before using this command.
About the author
Prasanna LM is a Software Engineer and a Tech Enthusiast from Bengaluru,India. He is also the founder and Chief Blogger at TechSagar.com. He specializes in developing softwares using Java and related technologies. He spends most of his free time in exploring new technologoes around the world wide web. He also advices novice bloggers in setting up their self hosted blogs using WordPress.
Currently Trending Articles
Our Weekly News Letter
Tag CloudAdsense android Apple apps bangalore barcamp blogger Blogging Cloud Computing download entrepreneur Facebook Firefox free softwares Google hard disk india indiblogger Internet iPad iphone Java laptop Linux macbook air Microsoft mobile Monetizers OpenID outlook plugins SEO social media tablet Tech Events Tech News Tech Tips twitter Virtualization web web 2.0 Windows Windows 7 Windows Vista WordPress