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.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.