MySQL 如何将单个表从 phpmyadmin 导出到逗号分隔的文本文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1802410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to export a single table from phpmyadmin to a comma delimited text file?
提问by seedg
I need to export a table from phpmyadmin to a comma delimited text file. I think there is a code but can't seem to find it. I found one but it doesnt work.
我需要将一个表从 phpmyadmin 导出到一个逗号分隔的文本文件。我认为有一个代码,但似乎无法找到它。我找到了一个,但它不起作用。
I need to export this table because I need to organize it and sort it and add another column so I can add data to this column.
我需要导出此表,因为我需要对其进行组织和排序并添加另一列,以便我可以向此列添加数据。
How can I do this please?
请问我该怎么做?
回答by jaywon
In PHPAdmin, if I recall correctly, there is an Export tab. If you click on that, you can select the table(s) you want to export and which format you would like to export the data in. CSV, .zip, .gzip, etc...
在 PHPAdmin 中,如果我没记错的话,有一个导出选项卡。如果单击它,您可以选择要导出的表以及要导出数据的格式。CSV、.zip、.gzip 等...
回答by sami
Execute this statement:
执行这个语句:
SELECT * FROM `table_name`
INTO OUTFILE 'directory' ->e.g /tmp/myTable.csv(Linux) or C:\myTable.csv(Windows)
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
回答by TheGrandWazoo
Select the database and click the 'Export' tab. Select the table to export. Use CSV as the format.
选择数据库并单击“导出”选项卡。选择要导出的表。使用 CSV 作为格式。
回答by Kristoffer
As mention before you have a export tab for do things things. But if you want to export a tricky question or a very special ordering you can do as following:
如前所述,您有一个用于执行操作的导出选项卡。但是,如果您想导出一个棘手的问题或一个非常特殊的排序,您可以执行以下操作:
Go to View or write your SQL question
In the bottom of the view-page you will have a Export link.
If you click on that you will now export the question (and its order)
in any format you chose