Question: how to extract data from mysql to text file?
Answer: MySQL - Database Export. The simplest way of exporting a table data into a text file is by using the SELECT... INTO OUTFILE statement that exports a query result directly into a file on the server host.