Does anyone know the key things that should be done when moving to MySQL 5.6 to reduce the amount of code changes required? I found that new installations of it have STRICT_TRANS_TABLES
set for sql_mode
by default.
I plan to go through the release notes and upgrade guides on the MySQL site in more depth but during a past upgrade which was only a point-release change, there was a backwards incompatible change that wasn't called out in the release notes
I wanted to see if anyone had anything noteworthy to mention from experience.
Best Answer
I ran headlong into this one 6 months
The only sane thing you can do is the following two steps
STEP 01
Add this to my.cnf under the
[mysqld]
group headerSTEP 02
Login as
root@localhost
and run thisRestarting mysql is not required.
STEP 03 (Optional)
STEP 02 only affects incoming connections after the change. You may have to kill all current DB Connections. Let the app reconnect and it will begin with sql_mode as blank. While restarting mysql is not needed for incoming connections, you could just run
service mysql restart
instead of custom scripting the killing of DB Connections.If you want to custom script the killing of your connections, please see some of my past posts for exmaples on how to kill many connections:
May 10, 2011
: kill all queries - MySQLJun 05, 2013
: Too Many database connections on Amazon RDSDec 25, 2013
: Mysql. Block/disconnect slow queriesSTEP 04 (Optional, Last Resort)
If you would like to make code changes, the only change would be to run
as the first command for the connection. Then, you could run your regular queries thereafter.
GIVE IT A TRY !!!
NOTE #1 : The first two steps are more than enough for your app if you close your connection right after running your query. If your connections are persistent, then you will need STEP 03.
NOTE #2 : If you are not allowed to change the configuration, you could skip STEP 01 and STEP 02 and just run STEP 03 and STEP 04.