Bug #2866 mysqldump adds drop table even without "--add-drop-table"
Submitted: 18 Feb 2004 5:59 Modified: 22 Mar 2004 7:30
Reporter: Rob Blick Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Linux (Redhat 9)
Assigned to: Documentation Team CPU Architecture:Any

[18 Feb 2004 5:59] Rob Blick
Description:
Executing mysqldump always inserts "DROP TABLE IF EXISTS tablename" before each CREATE TABLE statement, even if the --add-drop-table command line option is not used.  I do not have a my.cnf file that contains this option, either.

How to repeat:
mysqldump -u root -p test

Witness the "DROP TABLE IF EXISTS" in the following output:

--
-- Table structure for table `x`
--

DROP TABLE IF EXISTS x;
CREATE TABLE x (
  a text,
  b varchar(255) default NULL
) TYPE=MyISAM DEFAULT CHARSET=latin1;

Suggested fix:
Two options: either prevent the DROP TABLE IF EXISTS from appearing unless the --add-drop-table command line option is given to mysqldump, or provide another command line option to suppress the DROP TABLE IF EXISTS.
[18 Feb 2004 8:05] Alexander Keremidarski
This is because in 4.1 --opt is default for mysqldump:

  --opt               Same as --add-drop-table --add-locks --all --quick
                      --extended-insert --lock-tables --disable-keys. Enabled
                      by default, disable with --skip-opt.

Each of --add- options is Boolean so they can be disabled like

--add-drop-table=FALSE
--add-drop-table=0

To revert to 4.0 defaults --skip-opt can be used

  --skip-opt          Disable --opt. Disables --add-locks, --all, --quick,
                      --extended-insert, --lock-tables and --disable-keys.

I am assigning it to Documentation team as this is only to be documented better
[22 Mar 2004 7:30] Paul DuBois
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).