How can I turn off MySQL strict mode? or Solving Incorrect integer value problem with MySQL 5 strict-mode ~ Interview Questions & Answers

Wednesday, February 10, 2010

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


This can be done in two ways...
Open your "my.ini" (my.cnf in linux) 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= '';

0 comments: