There are 2 ways to do it.
1, save the result to a file in the sql query directly
select file_name
from files
limit 3
into OUTFILE '/tmp/file_capture_delete.list';
[root@localhost file_capture]# cat /tmp/file_capture_delete.list
20110311-154002_0001.bin
20110311-154002_0002.bin
20110311-154002_0003.bin
2, dump the results to a file
A, create a mysql file
[root@localhost delete_old_capture_file]# cat delete_old_capture_file.mysql
select file_name
from capture_files
limit 5
B, Run the mysql and dump the results to a file
mysql -u username -ppassword DBname < delete_old_capture_file.mysql > delete_old_capture_file.dump
No comments:
Post a Comment