Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does /*!xxxxxx statement */ generated by mysqldump mean?

I was always curious about what these comment enclosed preprocessor-like statements that mysqldump generates for me mean. Here's an example:

/*!40000 ALTER TABLE abc DISABLE KEYS */; 

The general pattern seems to be

/*![some numeric code] [some statement] */; 

Please point to proper documentation if exists. Otherwise explain. :)

like image 784
zedoo Avatar asked Jun 01 '10 11:06

zedoo


People also ask

What is Mysqldump command?

It dumps one or more MySQL databases for backup or transfer to another SQL server. The mysqldump command can also generate output in CSV, other delimited text, or XML format.

What is single transaction in Mysqldump?

Mysqldump with Transactions The --single-transaction flag will start a transaction before running. Rather than lock the entire database, this will let mysqldump read the database in the current state at the time of the transaction, making for a consistent data dump.

How do I dump a MySQL database?

To dump/export a MySQL database, execute the following command in the Windows command prompt: mysqldump -u username -p dbname > filename. sql . After entering that command you will be prompted for your password.


1 Answers

http://dev.mysql.com/doc/refman/5.1/en/comments.html

Comments of the form /*! stuff */ are treated as comments by other RDBMSs, but MySQL will read what's inside the comment and execute it as SQL. You can use this to take advantage of MySQL-specific features even using code that might be run against other RDBMSs. For example you could use /*! ENGINE=INNODB */ in a CREATE TABLE query.

The numbers are optional and if you use them then MySQL will ignore them if its version number is less than the number (with dots inserted in the appropriate places).

like image 131
Hammerite Avatar answered Oct 07 '22 13:10

Hammerite