Steps to disable mysql strict mode

kumkumsharma

Administrator
Staff member
In mysql database 5.7 version strict mode is enabled but if you are getting issue or your application requirement is to disable strict mode then you can check this article.

Mysql mainly helps to handle missing or invalid values in data change statements (INSERT or UPDATE). If mysql strict mode is disabled then mysql will handle missing or invalid values by produces warning.

If you are getting below errors then you have to disable mysql strict mode.

Code:
This behaviour is due to Strict Mode being enabled in your MySQL server configuration.

Please disable MySQL Strict Mode in your server configuration in order for WHMCS to function correctly.
Code:
Critical: MySQL enables "strict mode" by default as of version 5.7. Strict mode controls how MySQL handles invalid or missing values in data-change statements such as INSERT or UPDATE. Applications not built with strict mode enabled may cause undesired behaviour; please verify applications using MySQL are compatible before upgrading. More information about strict mode is available here.
  • Login to server with your SSH client.
  • Now you have to run below command to check the sql mode:
Code:
# mysql -e 'select @@GLOBAL.sql_mode;'
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
  • If there is STRICT_TRANS_TABLES", available then it means strict mode is enabled on server., you have to disabled it then you can check below steps:
  • Now open my.cnf file on up /etc/my.cnf location with your text editor.
  • You have to search for sql_mode and if there is no sql_mode option then you have to add below line in end of file.
Code:
sql_mode = "NO_ENGINE_SUBSTITUTION"
  • To reflect changes you have to restart MySQL service.
Code:
/scripts/restartsrv_mysql –force
 
Top