execute .sql file using command line

2019-05-29 04:09发布

问题:

I am trying to run a sql file located at /desktop/folder/query.sql in command line. I have the database changed to the one that I need but am unsure how to execute the file. Thanks in advance for any help

回答1:

answering my own question,

mysql> source desktop/folder/query.sql;

Just had to use the 'source' prefix.