write results of sql query to a file in mysql

前端 未结 5 980
心在旅途
心在旅途 2021-02-01 01:44

I\'m trying to write the results of a query to a file using mysql. I\'ve seen some information on the outfile construct in a few places but it seems that this only writes the fi

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 02:18

    mysql -v -u -c root -p < /media/sf_Share/Solution2.sql 2>&1 > /media/sf_Share/results.txt This worked for me. Since I wanted the comments in my script also to be reflected in the report I added a flag -c

提交回复
热议问题