Skip to content
Advertisement

MySQL syntax: What is this?

My exported SQL file contains the lines below:

/*!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 */;

What do these lines mean, unlike CREATE TABLE and INSERT INTO?

Advertisement

Answer

They are variable assignments. The assignments are wrapped in executable comments in such a way that they are executed when MySQL is used and left alone if some other RDBMS is used. Furthermore, the 40101 indicates that the comments are not to be retained in the database i.e. if the lines are executed, they are only executed when the sql file is executed.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement