3

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

amazingacademy
  • 143
  • 1
  • 9
  • 1
    What is the problem with using [MySQL-Doc: Executing SQL Statements from a Text File](http://dev.mysql.com/doc/refman/5.7/en/mysql-batch-commands.html)? – t.niese Dec 01 '14 at 20:39
  • I seem to be getting an error when trying to specify a directory /desktop/folder/query.sql. The server is remote with the file being local on my machine – amazingacademy Dec 01 '14 at 20:43
  • Just solved it. mysql> source desktop/folder/query.sql – amazingacademy Dec 01 '14 at 20:45
  • possible duplicate of [How to import an SQL file using the command line in MySQL?](http://stackoverflow.com/questions/17666249/how-to-import-an-sql-file-using-the-command-line-in-mysql) – t.niese Dec 01 '14 at 20:49

1 Answers1

5

answering my own question,

mysql> source desktop/folder/query.sql;

Just had to use the 'source' prefix.

amazingacademy
  • 143
  • 1
  • 9