Dovahkiin
Dovahkiin

Reputation: 257

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.

Upvotes: 1

Views: 1966

Answers (1)

Peter K
Peter K

Reputation: 1807

The proper syntax on windows is:

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

Upvotes: 1

Related Questions