GICT knowledge base
Disable MySQL Strict mode
Published
To disable strict mode on cpanel servers in mysql 5.6
edit /etc/my.cnf
add in under [mysqld]
sql_mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
for example
[mysqld]
default-storage-engine=MYISAM
local-infile=0
innodb_file_per_table=1
max_allowed_packet=268435456
query_cache_limit=4M
query_cache_size=128M
query_cache_type=1
innodb_flush_log_at_trx_commit=2
innodb_lock_wait_timeout=200
max_connections=500
max_user_connections=45
# innodb_force_recovery = 6
open_files_limit=10000
sql_mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
restart mysql with /etc/init.d/mysql restart
To confirm test with the following command:
mysql> SELECT @@sql_mode;
+—————————————————————————————————-+
| @@sql_mode |
+—————————————————————————————————-+
| NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+—————————————————————————————————-+
1 row in set (0.00 sec)
If you see STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION strict mode is still enabled.
Related guides
Check MariaDB Versions and Compatibility on Shared Hosting
Check your actual MariaDB/MySQL server version, maintenance coverage and application requirements before requesting a shared-hosting upgrade or move.
MySQLHow to Monitor MySQL Database Server Performance
Learn how to monitor MySQL performance with 4 essential Linux command-line tools.
MySQLHow to secure MySQL connections with SSL on Ubuntu
MySQL allows remote connections and we must protect data transfer happeneing between servers with SSL. Follow this tutorial to learn how.
MySQLHow to set up High Availability WordPress with HyperDB
HyperDB is a drop-in plugin that allows you to set up High Availability WordPress site that can work with multiple database servers at once.
