Jump to content

Running SQL from File with MySQL

- - - - -

  • Please log in to reply
2 replies to this topic

#1
LukeyJ

LukeyJ

    Learning Programmer

  • Members
  • PipPipPip
  • 93 posts
Hi all,

I'm trying to run a SQL file from the mysql command prompt. I connect to a DB and type:

source c:\etc...

without the dots. Unfortunately, I lose the prompt as if it is expecting more input. I type in ; to end it, but it won't stop reading. cntrl and C closes the window. Am I doing this correctly?

I have 3 SQL commands in the .sql file.

Any help would be brilliant.

#2
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
try adding quote "" around the file name

Did you select the database first (with use databaseName; )
And did you put the ; at the end of the first line?

If this is a long query, it may take some time.

#3
LukeyJ

LukeyJ

    Learning Programmer

  • Members
  • PipPipPip
  • 93 posts
Thanks for the input.

I'm sorry to say it was a very silly mistake on my part. I saved it as a text file. So it didn't register the file name. Shame there was no meaningful warning. I'd just about given up on this, so thanks for pushing me just this little further to getting over the line! Blocker removed!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users