Documentation Home
MySQL 9.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 41.2Mb
PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.4 Reference Manual  / MySQL 9.4 Frequently Asked Questions  /  MySQL 9.4 FAQ: Server SQL Mode

A.3 MySQL 9.4 FAQ: Server SQL Mode

A.3.1. What are server SQL modes?
A.3.2. How many server SQL modes are there?
A.3.3. How do you determine the server SQL mode?
A.3.4. Is the mode dependent on the database or connection?
A.3.5. Can the rules for strict mode be extended?
A.3.6. Does strict mode impact performance?
A.3.7. What is the default server SQL mode when MySQL 9.4 is installed?

A.3.1.

What are server SQL modes?

Server SQL modes define what SQL syntax MySQL should support and what kind of data validation checks it should perform. This makes it easier to use MySQL in different environments and to use MySQL together with other database servers. The MySQL Server apply these modes individually to different clients. For more information, seeSection 7.1.11, “Server SQL Modes”.

A.3.2.

How many server SQL modes are there?

Each mode can be independently switched on and off. SeeSection 7.1.11, “Server SQL Modes”, for a complete list of available modes.

A.3.3.

How do you determine the server SQL mode?

You can set the default SQL mode (formysqld startup) with the--sql-mode option. Using the statementSET [GLOBAL|SESSION] sql_mode='modes', you can change the settings from within a connection, either locally to the connection, or to take effect globally. You can retrieve the current mode by issuing aSELECT @@sql_mode statement.

A.3.4.

Is the mode dependent on the database or connection?

A mode is not linked to a particular database. Modes can be set locally to the session (connection), or globally for the server. you can change these settings usingSET [GLOBAL|SESSION] sql_mode='modes'.

A.3.5.

Can the rules for strict mode be extended?

When we refer tostrict mode, we mean a mode where at least one of the modesTRADITIONAL,STRICT_TRANS_TABLES, orSTRICT_ALL_TABLES is enabled. Options can be combined, so you can add restrictions to a mode. SeeSection 7.1.11, “Server SQL Modes”, for more information.

A.3.6.

Does strict mode impact performance?

The intensive validation of input data that some settings requires more time than if the validation is not done. While the performance impact is not that great, if you do not require such validation (perhaps your application already handles all of this), then MySQL gives you the option of leaving strict mode disabled. However, if you do require it, strict mode can provide such validation.

A.3.7.

What is the default server SQL mode when MySQL 9.4 is installed?

The default SQL mode in MySQL 8.0 includes these modes:ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO, andNO_ENGINE_SUBSTITUTION.

For information about all available modes and default MySQL behavior, seeSection 7.1.11, “Server SQL Modes”.