Home » Mysql » SQL Syntax; What is this?

SQL Syntax; What is this?

Posted by: admin November 29, 2017 Leave a comment


My exported sql file contains belowed lines;

/*!40101 SET @[email protected]@CHARACTER_SET_CLIENT */;
/*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */;
/*!40101 SET @[email protected]@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

What are that lines means, unlike CREATE TABLE, INSERT INTO ?


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.


This is variable assignments wrapped within conditional comments. The code is executed depending on the version of MySQL in question, see comments


These lines are comment.
SQL Comment can start by -- till end of line or can be surrounded by /* ... */

I think that lines are related to the file encoding of your exported sql file.