Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unclear result of mysqldump

Why are these lines present in output of mysqldump?

  /*!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 */;
  /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  /*!40103 SET TIME_ZONE='+00:00' */;
  /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;

They have been commented and start with ![some number]. What does it mean?

like image 759
krisk Avatar asked Oct 04 '14 10:10

krisk


1 Answers

This

/*!40014

just makes sure, that the following command is executed only, if the MySQL version is at least 4.00.14.

This

SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT

stores the current settings of MySQL. Variables starting with @@ are system variables, variables starting with @ are user defined variables.

After the import of data is finished, MySQL will restore the original state with statements the other way round, such as

/*!40101 SET @@CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
like image 50
fancyPants Avatar answered Sep 20 '22 03:09

fancyPants