Bug #62369 mysql client - Source command for reading files depends on which OS ??
Submitted: 7 Sep 2011 7:24 Modified: 13 Sep 2011 18:47
Reporter: Don Cohen Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[7 Sep 2011 7:24] Don Cohen
Description:
I'm not sure how to classify this problem so you bug handlers have to help me.
In fact it might be correct behavior that I just fail to understand.
I have a windows machine running mysql server 5.5.
If I connect to it using the mysql client on that same machine the following
command works:
  source d:\Dropbox\database\capuchintest.sql
However, if I connect to it (same user, same DB) from another machine running
linux or macos (haven't tried from another windows machine) and execute the
exact same command, I get
  ERROR: 
  Failed to open file 'd:\Dropbox\database\capuchintest.sql', error: 2
I thought that no matter where the client runs, it sends the same command to
the server and the server should do the same thing in response.
Am I missing something important?

How to repeat:
just connect to same server from three different places and get 2 different results...
I only have one windows server to try.
[7 Sep 2011 8:02] Don Cohen
It now finally occurs to me that the source command is supposed to cause
the CLIENT to read the file and send its contents to the server.
Is there a command that causes the SERVER to read a file?
Similarly, I now think the system command causes the client to execute
the command on its own system - is there a way to get the command executed
on the server?
[7 Sep 2011 9:06] Valeriy Kravchuk
SQL is sent to server from client. So it should be some client (maybe running on the same machine as server) that will send SQL to server for further execution. SOURCE is a command of mysql command line client.
[13 Sep 2011 18:47] Don Cohen
The whole area of what's done on client vs server is not very clear from documentation and when I do understand it I see problems.
http://dev.mysql.com/doc/refman/5.5/en/load-data.html says
  LOAD DATA INFILE is the complement of SELECT ... INTO OUTFILE. (See Section  
  12.2.9, “SELECT Syntax”.) To write data from a table to a file, use SELECT ...  
  INTO OUTFILE. To read the file back into a table, use LOAD DATA INFILE.
However, this is not correct.
Load reads data from the client, while select into outfile writes on the server!
Is there a way to write to a file on the client from the mysql command line?
(I know you can do it with -B -e command.)
[13 Sep 2011 19:02] Peter Laursen
Correction:

LOAD DATA INFILE reads file from the server
LOAD DATA LOCAL INFILE read file from the client machine

SELECT INTO OUTFILE saves a file on the server
(and SELECT INTO LOCAL OUTFILE is not supported unfortunately).

But I do not understand how this is related to the topic/discussion here ('Source command .. )? A file loaded with SOURCE command will have to be (valid) SQL if it shall not raise an error.  INFILE's and OUTFILES are CSV-files (in the widest possible meaning of the term).

Peter
(not a MySQL person)