MySQL转储文件并注释掉行

问题描述:

我在MySQL .sql文件(与phpMyAdmin转储)的顶部有这些行:

I have these lines at the top of a MySQL .sql file (dumped with phpMyAdmin):

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

但是它们似乎都被注释掉了.那么,当文件重新加载到数据库中时,MySQL将忽略它们吗?如果是这样,为什么还要生成这些行呢?

But they all seem to be commented out. So will MySQL ignore them when the file is loaded back into a database? If so, why generate these lines at all?

这些是针对特定版本的mySQL的条件注释.

These are conditional comments aimed at certain versions of mySQL.

来自此处:

  • MySQL版本特定注释以/*!
  • 开头
  • 并以*/
  • 结尾
  • 版本号始终为5位数字
  • 版本号采用主发行版号的格式, 次要版本号,主版本号为1位数的修订号 次要版本和修订版本为2位数,左后加0的数字
  • 特定于版本的注释将定位到等于或高于该版本的任何版本 列出的版本号
  • MySQL version specific comments start with /*!
  • And end with */
  • Version numbers are always 5 digits
  • Version numbers are in the format major release number, minor release number, revision number with the major being 1 digit and the minor and revision being 2 digits left-padded with 0’s
  • Version specific comments will target any version equal to or higher than the version number listed