If you are using MAMP on Mac, any change to the variable in MySQL will be erased when you restart MAMP. To make sure the change is permanent do the following:
Stop the MAMP Servers that are running.
Use a text editor to create a file named my.cnf and save it to the /Applications/MAMP/conf folder. Put the file at the root of the folder (which seems a bit odd as it contains tons of apache folders and all but that's ok). Add the following lines into the file:
[mysqld] sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
[mysqld]
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Save the file and close your editor. Start the MAMP servers.
This will make the change permanent.