![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
IP: 49.87.2.233
|
|||
|
|||
|
在mysql中如果我们要把查询导出来保存.sql文件我们可以使用into outfile或mysql -uroot -p 就可以实现了,下面我来给大家介绍介绍。
1.新建查询语句文件query.sql,内容如下: Code:
use appdb; set names utf8; select FeedID, City , Message from Feed limit 1000; 2.执行如下: Code:
[root@proxy tianqg]# mysql -uroot -p < query.sql > query.txt 上面生成的txt文件如果要保存成.sql文件我们可如下操作 在服务器端可以用select into outfile 命令把查询结果保存到一个可写的目录中: Code:
mysql> select * from article limit 150 into outfile '/test/article.sql'; Query OK, 150 rows affected (0.01 sec) Code:
load data local infile "D:/study/article.sql" into table cmstop_article; |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|