Created a file called query.sql using notepad as per page 410 in
Saved it to c:/program files/easyphp/mysql/bin/query.sql
When I go back to mysql>
? you have an error in line 1?
Same thing happens if I save query.sql in
What am I doing wrong?
I want to have this file to save retyping several lines of code
Well, you're not exactly telling mysql that it's to read in SQL commands from a
file. the mysql> prompt is a command prompt; just like your shell prompt.
Your shell prompt expects commands that it recognizes.
Put it this way; if you were at your shell prompt and you wanted to see the
contents of your sql file, do you type "cat query.sql" or "query.sql"?
Typing "help" at the mysql prompt yields:
Note that all text commands must be first on line and end with ';'
help (\h) Display this help.
? (\?) Synonym for `help'.
clear (\c) Clear command.
connect (\r) Reconnect to the server. Optional arguments are db and host.
ego (\G) Send command to mysql server, display result vertically.
exit (\q) Exit mysql. Same as quit.
go (\g) Send command to mysql server.
notee (\t) Don't write into outfile.
print (\p) Print current command.
quit (\q) Quit mysql.
rehash (\#) Rebuild completion hash.
source (\.) Execute a SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
Connection id: 1 (Can be used with mysqladmin kill)
Does anything there look like it will execute an SQL file? Yes. "source".
mysql> source query.sql;