简体   繁体   中英

how to import delimited data into mysql in phpmyadmin

This is a sample of the data im working with

24701||37.279788||-81.229023||WV||BLUEFIELD||MERCER

as you can see its double pipe delimited. phpmyadmin is asking me for the following

Fields Terminated By  
Fields Enclosed By    
Fields Escaped By  
Lines Terminated By  

what do i put to correctly import my data?

I found this very useful and maybe this can help others.

In the Format-Specific Options section you can set the values as follows:

Columns separated with: You can choose , or \\t for tab delimited

Columns enclosed with: You can leave this empty but if even one column is enclosed in " then enter " (quotes)

Columns escaped with: You have to enter \\ (backslash)

Lines terminated with: You can leave this auto

Hope this helps

mysqlimport works with --fields-terminated-by="||"

Fields Terminated By ||

Looks like PHPMyAdmin doesn't. Then you have to do a replace, but be careful that you aren't messing with your data (ie, if you replace || for , be sure there are no further , characters in the original)

Did a find/replace in notepad++ of || and replaced it with comma so the data read

24701,37.279788,-81.229023,WV,BLUEFIELD,MERCER

Then filled in the following:

Fields Terminated By ,
Fields Enclosed By 
Fields Escaped By \
Lines Terminated By auto

worked great

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM