mysql select and save to file code example
Example 1: mysql query result to file
mysql -user -pass -e "select cols from table where cols not null" > /tmp/output
Example 2: mysql cli output to a file
mysql> tee /tmp/my.out;
mysql -user -pass -e "select cols from table where cols not null" > /tmp/output
mysql> tee /tmp/my.out;