A.3 MySQL 5.7 FAQ: Server SQL Mode

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, see *note sql-mode::.

How many server SQL modes are there?

Each mode can be independently switched on and off. See *note sql-mode::, for a complete list of available modes.

How do you determine the server SQL mode?

You can set the default SQL mode (for note 'mysqld': mysqld. startup) with the '--sql-mode' option. Using the statement note 'SET [GLOBAL|SESSION] sql_mode='MODES'': set-variable, 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 a 'SELECT @@sql_mode' statement.

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 using *note 'SET [GLOBAL|SESSION] sql_mode='MODES'': set-variable.

Can the rules for strict mode be extended?

When we refer to strict mode, we mean a mode where at least one of the modes 'TRADITIONAL', 'STRICT_TRANS_TABLES', or 'STRICT_ALL_TABLES' is enabled. Options can be combined, so you can add restrictions to a mode. See *note sql-mode::, for more information.

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.

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

The default SQL mode in MySQL 5.7 includes these modes: 'ONLY_FULL_GROUP_BY', 'STRICT_TRANS_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'ERROR_FOR_DIVISION_BY_ZERO', 'NO_AUTO_CREATE_USER', and 'NO_ENGINE_SUBSTITUTION'.

For information about all available modes and default MySQL behavior, see *note sql-mode::.

 File: manual.info.tmp, Node: faqs-stored-procs, Next: faqs-triggers, Prev: faqs-sql-modes, Up: faqs