mysql excute statement output to file code example
Example 1: execute mysql file
mysql -u yourusername -p yourpassword yourdatabase < text_file
Example 2: mysql cli output to a file
mysql> tee /tmp/my.out;
mysql -u yourusername -p yourpassword yourdatabase < text_file
mysql> tee /tmp/my.out;