Bug #39233 --sql-append --sql-prepend options to mysqldump

Submitted: 4 Sep 2008 9:17
Reporter: Morgan Tocker Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:6.0+ OS:Any
Assigned to: CPU Architecture:Any

[4 Sep 2008 9:17] Morgan Tocker
Description:
mysqldump needs an --sql-append and --sql-prepend option so I can adhoc add things like "FLUSH LOGS" to the start of it's output.

How to repeat:
shell> mysqldump --sql-append='FLUSH LOGS' -F --all-databases --master-data=2 > backup.sql
[8 May 2009 0:04] Jim Winstead
I'm not sure what advantage this has over just using standard shell constructs like this:

(echo "FLUSH LOGS" && mysqldump ... && echo "-- All done!") > dump.sql
[21 Jul 2009 15:02] Morgan Tocker
Having it in the tool is a lot easier for cross shell/operating system compatibility.
[18 Feb 2012 1:11] Shantanu Oak
I will request one more option that will actually execute the SQL statement instead of simply printing it out.

--sql-append-execute='FLUSH LOGS'

This is similar to ...

mysql -e"flush logs" && mysqldump ...

sql execute will not add anything to the output.
[20 Feb 2013 17:36] Victor Belyaevski
patch to --sql-append --sql-prepend options

Attachment: mysqldump.sqlappend_sqlprepend.patch (text/x-patch), 2.38 KiB.

[4 Mar 2013 9:12] Shantanu Oak
The patch provided by Victor seems to be working as expected.

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

Page generated in 0.040 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.