MySQL flags in dumps

Looking at the mySQL dump, I ran into something and would like to know what it is.

I see:

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

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

+4
source share
3 answers

Discussed on MySQL forums / mailing lists here .

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

This is the "function" of MySQL. Any other DBMS will consider this as a comment.

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

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

This is a way to make SQL script compatible with various versions of MySQL and allows you to include new features.

+3
source

50001 is a value indicating your version of mysql.

This is version 5.00.01 or 5.0.1 in the real world, but leaves room for a sub-version and release of more than 9.

This is a way to create a SQL script that is compatible with various versions of MySQL and allows you to include new features.

+1
source

500001 refers to the version of MySQL that generated the file.

It will be 5.00.01 or 5.0.01

+1
source

Source: https://habr.com/ru/post/1202930/


All Articles