您可以使用MySQL的SELECT INTO OUTFILE语句来导出二进制文件。以下是一个示例:
SELECT * INTO OUTFILE '/path/to/output/file' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM table_name;
在这个示例中,您需要将/path/to/output/file
替换为您希望导出的文件的路径,table_name
替换为您希望导出数据的表名。您还可以根据需要调整FIELDS TERMINATED BY
,OPTIONALLY ENCLOSED BY
和LINES TERMINATED BY
选项来定义导出文件的格式。
请注意,您需要有适当的权限来执行SELECT INTO OUTFILE语句,并且MySQL服务器必须具有写入所选择文件的权限。