Bug #6757 #!/usr/bin/mysql
Submitted: 22 Nov 2004 23:16 Modified: 23 Nov 2004 8:59
Reporter: Are you mortal Then prepare to die. Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:any OS:*nix
Assigned to: Sergei Golubchik CPU Architecture:Any

[22 Nov 2004 23:16] Are you mortal Then prepare to die.
Description:

I would like to be able to create a mysql 'script' with the following (common) style...

__BEGIN_EXAMPLE_FILE__
#!/usr/bin/mysql

-- SQL goes here. 
-- Example...

SET @userVariable = $1;

SELECT @userVariable;

-- Any valid stuff...

__END_EXAMPLE_FILE__

Then I would chmod +x the file and 'execute' it from the command line (possibly with some mysql options thrown in??).

Their was some discussion of this syntax some time back, but I couldn't find it anymore.

How to repeat:

Hey hey!

Suggested fix:

Need to work out how to distinguish mysql options from options to be passed to the script.
[23 Nov 2004 8:59] Sergei Golubchik
Use

#!/usr/bin/mysql -e source -e