Bug #44124 mysql: add --source/--sql/--file or similar
Submitted: 7 Apr 2009 7:50 Modified: 7 Apr 2009 9:14
Reporter: Jørgen Austvik Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:6.0-perf OS:Any
Assigned to: CPU Architecture:Any

[7 Apr 2009 7:50] Jørgen Austvik
Description:
In mysql client interactive mode there is a command to read SQL commands from file:

mysql> \h
...
source    (\.) Execute an SQL script file. Takes a file name as an argument.

This option is not available from the command line. It would be good to have it for scripting purposes.

How to repeat:
mysql --source file.sql
(get the help output)

Suggested fix:
Add a --source=filename.sql to mysql client.

Workaround:
cat file.sql | mysql
[7 Apr 2009 8:02] Valeriy Kravchuk
What's wrong with mysql < test.sql?
[7 Apr 2009 8:27] Jørgen Austvik
"mysql < file.sql" is a workaround similar to the "cat | mysql" I mentioned in the bug report.

They both depend on the shell, which can be a (minor) problem when you script them.