Page 1 of 1

Newbie MySQL question about paths

Posted: Sun Jan 18, 2009 4:37 am
by robincanaday
I'm trying to use mysql cli in Windows to read a source sql file and run the queries therein.

I run this command:

Code: Select all

source c:\xampp\mysql\sql_files\common\tables.sql;
When I do this, it treats every backslash as a command starter... it says that \x and \m are not valid commands, then shows a status, then tries to clear the command, then does the notee command... How do I a build a path in mysql without it reading the backslashes as command starters? I tried enclosing the path in single quotes, and tried enclosing she slashes in single quotes and neither worked. Is there some other way to make the path string literal?

If I move and rename the file and run the command again:

Code: Select all

source ..\m\m.sql;
It will work after still telling me that \m is not a valid command twice.

I'm sure it's just such an elemental thing that Google failed me on this one...
Thanks for any help!

Re: Newbie MySQL question about paths

Posted: Sun Jan 18, 2009 5:46 am
by it2051229
in case of path use '\\'
something like
c:\\whatever\\whatever\\whatever.sql

Re: Newbie MySQL question about paths

Posted: Sun Jan 18, 2009 6:33 am
by robincanaday
it2051229 wrote:in case of path use '\\'
something like
c:\\whatever\\whatever\\whatever.sql
Hmm, it runs correctly after giving me an 'Unknown Command \\' error for each double backslash.
It's better than calling other random commands :P.

Thanks :).

Re: Newbie MySQL question about paths

Posted: Mon Jan 19, 2009 1:07 am
by it2051229
well... shouldn't it be like
source "c:\\xampp\mysql\\sql_files\\common\\tables.sql";

if not then use the forward slash (/)

Re: Newbie MySQL question about paths

Posted: Mon Jan 19, 2009 1:21 am
by robincanaday
Forward slash did it, thanks!
Odd that backslashes worked at all :P... it really confused everything.