网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 服务器与数据库 > MySQL
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 112.87.30.213
Old 2016-08-17, 07:20 AM
Tamarack Tamarack is offline
初级会员
 
Join Date: 2005-06-23
Posts: 1
Tamarack 现在声名狼藉
Default mysql把查询结果保存为sql文件

今天要做一个mysql数据库得测试,有一张表有120多万条数据,但是我只需要从中抽取一部分来测试,拿到本地服务器来测试,原本印象中导出命令是mysqldump 导出整张表,所以烦恼了,有没有什么好办法解决上面得困惑,于是百度之,最后发现了两个好玩的命令,感觉不错,分享一下:

在服务器端可以用select into outfile 命令把查询结果保存到一个可写的目录中:
Code:
	mysql> select * from article limit 150 into outfile'/test/article.sql';
然后把article.sql文件下载到本地电脑上,通过load data local infile into table 命令来导入这个查询结果文件:
Code:
	mysql>load data local infile "D:/study/article.sql" into table article;
Code:
load data local infile "D:/study/article.sql" into table cmstop_article;
这样就搞定了。
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:11 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.