2018年2月4日 星期日

phpMyAdmin import .csv file


14天免費試用工具
https://www.webyog.com/product/sqlyog
use SQLyog instead. You just have to select the Table in Object Browser(Ctrl+SHift+1). Just select Table > Import > Import CSV Data Using Load Local(Ctrl+Shift+M).
enter image description here
--------------------------------------------------------------------------------------------------
1) Using PhpMyAdmin create a database.
2) Create a table within that database with exact same column names that matches the order and spelling of your csv file columns.
For example, if you have two columsn in your csv file – id, name. Your table must have those matching columns – id and name. Make sure you pay attention when you select the data type for each column. For example, id needs to be an int and name could be a varchar.
3) Make sure your excel file isn’t a excel spreadsheet. If it is, save it as csv comma dellimited. (This is very important)
Now, using phpmyadmin Select the databaes table and click on import.
Make sure you have carefully checked the following options
1. Check if your cvs file’s column name match your table column name
2. Browse your required .csv file (while import tab is selected)
3. Select CSV using LOAD DATA options
4. Tick ‘ON’ for Replace table data with file
5. Put , in terminated by box type field
6. Put ” in enclosed by box field
7. Put \ in escaped by box field
8. Put auto in Lines terminated by box field
9. In Column names box, type all the column names seperated by comma. i.e column1,column2,column3 (this must match with your table and csv column header).
10 Tick ‘ON’ for Use LOCAL keyword
Hit Go!

沒有留言:

張貼留言