Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

execute .sql file using command line

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

like image 271
amazingacademy Avatar asked Aug 12 '26 19:08

amazingacademy


1 Answers

answering my own question,

mysql> source desktop/folder/query.sql;

Just had to use the 'source' prefix.

like image 52
amazingacademy Avatar answered Aug 15 '26 10:08

amazingacademy