如何将临时 MySQL 表转储到文件中?
有没有一种方法可以创建转储/导出/保存临时 MySQL 表到磁盘上的文件中(.sql 文件,类似于 mysqldump 创建的文件)?
Is there a way to create a dump/export/save a temporary MySQL table into a file on disk(.sql file that is, similar to one that is created by mysqldump)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,我第一次没有正确阅读问题...无论如何,我能想到的最好的方法是使用 SELECT ... INTO OUTFILE 语句,如下所示:
这确实有许多限制,例如,它只转储原始数据而不包括字段标题。我发现可能有用也可能没用的另一件事是 SHOW CREATE TABLE 语句。如果您能找到某种方法来组合这两个语句的输出,您也许能够获得由我的下面的命令生成的正确的“转储”文件。
您应该能够使用
mysqldump
应用程序:这将转储带有
CREATE
减速的表。Sorry, I did not read the question properly the first time around... at any rate, the best I can think of is using the
SELECT ... INTO OUTFILE
statement, like this:This does have many limitations thought, for instance, it only dumps the raw data without including the field headers. The other thing I found that may or may not be of use is the
SHOW CREATE TABLE
statement. If you can find some way of combining the output from these two statements, you may be able to get a proper "dump" file as produced by my command below.You should be able to use the
mysqldump
application:This will dump the table with
CREATE
decelerations.