简体   繁体   English

如何在phpmyadmin中将定界数据导入mysql

[英]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 phpmyadmin向我询问以下内容

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 列分隔为: 您可以选择或\\ t来制表符分隔

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="||" mysqlimport与--fields-terminated-by =“ ||”一起使用

Fields Terminated By ||

Looks like PHPMyAdmin doesn't. 看起来好像没有PHPMyAdmin。 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 很棒

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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