Tuesday, March 2, 2010

How can I turn off MySQL strict mode? or Solving Incorrect integer value problem with MySQL 5 strict-mode

To turn off strict_mode in MySQL

This can be done in two ways...

Open your "my.ini" file within the MySQL installation directory, and look for the text "sql-mode".

Find:
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Replace with:

# Set the SQL mode to strict
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Or, you can run an SQL query within your database management tool, such as phpMyAdmin:

SET @global.sql_mode= '';