12

Looking at a mySQL Dump, I have come across something and like to know what they are.

I see:

/*!50001 DROP TABLE IF EXISTS `xxx` */;

What is the flag 50001, is there a list of what they mean?

BillyBigPotatoes
  • 1,282
  • 11
  • 23
Jamie Teuma
  • 296
  • 1
  • 4
  • 13

3 Answers3

16

It is discussed on the MySQL's forums/mailing lists here.

/*!50001 DROP TABLE `category_count_view`*/; 

This is a "feature" of MySQL. Any other RDBMS will treat this as a comment.

But, MySQL looks at 50001 and checks that as a MySQL version. This is Version 5.00.01, or 5.0.1 in the real world, but leaves room for the the sub-version and release to be greater than 9.

MySQL will treat the line as a comment if MySQL is below 5.0.1, and will process the line if MySQL is greater than or equal to 5.0.1.

It's a way making a SQL script compatible with different versions of MySQL, and allows new features to be included.

hjpotter92
  • 75,209
  • 33
  • 136
  • 171
3

The 500001 is regarding the MySQL version that generated the file.

This would be 5.00.01 or 5.0.01

BillyBigPotatoes
  • 1,282
  • 11
  • 23
2

50001 is a value that indicate your mysql version.

This is Version 5.00.01, or 5.0.1 in the real world, but leaves room for the the sub-version and release to be greater than 9.

It's a way making a SQL script compatible with different versions of MySQL, and allows new features to be included.

Ganz
  • 187
  • 5