How to turn off MySQL STRICT mode

Sometimes MySQL STRICT mode cause Zencart to throw the following error:

PHP Fatal error: 1406:Data too long for column ‘products_name’ at row 1

To resolve this issue you need to turn off MySQL STRICT mode. You can achieve this by two methods.

1. Edit MySQL global configuration file

Open MySQL configuration file vi /etc/my.cnf

and search for the word sql_mode Here you can see a lot of variable removes all other variables and keep the variable NO_ENGINE_SUBSTITUTION

sql_mode = NO_ENGINE_SUBSTITUTION

exit editor and restart MySQL service

To confirm the STRICT mode is turned off please run the following command at the command line

# mysql -e ‘select @@GLOBAL.sql_mode;’

It will return a result as follows.

+————————+
| @@GLOBAL.sql_mode |
+————————+
| NO_ENGINE_SUBSTITUTION |
+————————+
2. WHM global PHPMyAdmin

You can turn off MySQL STRICT mode from WHM PHPMyAdmin as well. Login to WHM -> SQL services -> PHPMyAdmin

Click variables ( Top right side ) and search for the word “SQL mode” Here you can see an option to edit the variables. Remove all variable except NO_ENGINE_SUBSTITUTION

 

mysq_strict_mode_image

Leave a Reply

Your email address will not be published. Required fields are marked *