简体   繁体   中英

Using MySQL source command to run script in text file

What I want to know is how to run code which I have put in a text file, in the MySQL command line client, using the SOURCE command. (The text file I put the code in is called 'Testrun').

I know it starts by:

SOURCE C:\Users\Emily\Documents\MySQLpractice

but I don't know how to finish the command. I understand you have to put the file name afterwards, but is there a backslash, a forward slash or something else in-between that and the file path?

What's in the text file:

USE exams;
SELECT * FROM students;

I have tried to look up the answer before but people said different things each time, and I couldn't get anything to work. Help is hugely appreciated.

Windows 上的正确语法是:

SOURCE C:/Users/Emily/Documents/MySQLpractice/File.sql;

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