简体   繁体   中英

Executing mysql command using a batch file

I am new to mysql. I've been trying to run a query through windows notepad batch file. The code on the file is:

USE menagerie 
SELECT type FROM event

The directory I typed on mysql command line is:

C:/Users/abu/Desktop/ev.txt

The output is: -> indicating something must be added to complete the command. Please tell me what is missing to complete the code.

You need to use the source command to execute queries from a file.

mysql> source C:/Users/abu/Desktop/ev.txt

Also, the file needs to have ; between queries. So the first line should be

USE menagerie;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM