1. 语法格式.
select... from 表名
into outfile "文件名"
fields terminated by "分隔符"
lines terminated by "分隔符"
�2.实际演练.
mysql> select * from userinfo02
-> into outfile"/var/lib/mysql-files/userinfo.txt"
-> fields terminated by ":"
-> lines terminated by "\n";
Query OK, 47 rows affected (0.00 sec)
3.查看文件.
root@tedu:/var/lib/mysql-files# cat userinfo.txt
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
OK .