I came across what I thought was a relatively simple problem, but haven't been able to find a solution. I wrote an extremely complex query in the MySQL shell and I'd like to save the query to a text file to use later and across systems (to use across redundant copies of the DB, and I unfortunately cannot copy paste).
Is there a simple way to do this, or will I have to manually retype the query into a text file?
mysql -u root -p