Import a CSV file to MySQL via phpMyAdmin
Since there were no articles around for this topic from searching google, I thought I would write a short article on helping you import a CSV file to Mysql via phpMyAdmin.
I had recieved a large excel sheet, some 16k rows and 20 columns large, and needed to transfer this to mysql for a postage calculation. Ill lead you through the steps to achieve this process.
- Name your columns appropriately in the Excel File
- Set up identical columns names in correct order in the MySQL db
- Export your excel document as a csv (the .csv should be the same name as your table set up in phpMyAdmin)
- Open the csv file and cut the column names out (so they are on your pasteboard) that appear at the top
- You should have just comma delimted data

- Go to Import Tab and add the location of your text file
- Select CSV using LOAD DATA
- Check 'Replace table data with file'
- Change Fields terminted to a comma, and remove enclosed and encapsulated fields
- Paste the column names from your clip board into the column names field
- Untick 'Use LOCAL keyword

Once submitted, the next page should like something like the above. If you have any questions, please post a comment.


Comments
Post new comment