MySQL Error: Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'
3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 13, 2023 (RSS)
Hi, All.
My client's site has gone down, and there's this error message when you visit it: https://www.masselsmarine.com/
MySQL Error: Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'
Any idea what might be causing this, please?
By Dave - May 12, 2023
Hi CommonSenseDesign,
It may be because the host upgraded the version of PHP or MySQL and you have an older version of CMSB.
For a short-term fix you can edit /lib/mysql_functions.php and search for: NO_AUTO_CREATE_USER then remove the comma (",") and NO_AUTO_CREATE_USER from these lines:
# set MySQL strict mode - http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
if ($strictMode) {
$query = "SET SESSION sql_mode = 'STRICT_ALL_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER'";
mysql_query($query) or die("MySQL Error: " .mysql_error(). "\n");
}
else {
$query = "SET SESSION sql_mode = 'NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER'";
mysql_query($query) or die("MySQL Error: " .mysql_error(). "\n");
}
Be sure to make a backup of the file first.
And then for a more long-term solution, you could upgrade to the latest version of CMSB which supports the latest MySQL and PHP versions.
Hope that helps! Let me know if you have any questions.
interactivetools.com