During the use of MySQL, you may encounter some error messages. This article will introduce some common MySQL error messages and provide corresponding solutions.
Report an error message
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). [Warning] 'ERROR_FOR_DIVISION_BY_ZERO' is deprecated and will be removed in a future release. [Warning] 'NO_ZERO_DATE' is deprecated and will be removed in a future release. [Warning] 'NO_ZERO_IN_DATE' is deprecated and will be removed in a future release.
TIMESTAMP with implicit DEFAULT value is deprecated
This warning message is received when creating a table in MySQL if the implicit default value of the TIMESTAMP type is used. This is because the implicit default TIMESTAMP type will be deprecated in future versions. To solve this problem, we can set it accordingly in the MySQL configuration file.
Open MySQL's configuration file (or), find the paragraph containing [mysqld], and add the following line to that paragraph:
explicit_defaults_for_timestamp=true
After setting this way, MySQL will no longer use the TIMESTAMP type of implicit default value, but will need to explicitly specify the default value.
'ERROR_FOR_DIVISION_BY_ZERO' is deprecated and will be removed in a future release
When performing zero-dividing in MySQL, this warning message is received if ERROR_FOR_DIVISION_BY_ZERO mode is used. This is because the ERROR_FOR_DIVISION_BY_ZERO mode will be removed in future versions. To solve this problem, we need to modify the sql_mode setting of MySQL.
In MySQL's configuration file, find the settings item for sql_mode and remove the part that contains ERROR_FOR_DIVISION_BY_ZERO. For example, set the following:
sql_mode="ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES"
Modified to:
sql_mode="ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES"
After this setting, MySQL will no longer use ERROR_FOR_DIVISION_BY_ZERO mode, thereby avoiding error reports.
'NO_ZERO_DATE' and 'NO_ZERO_IN_DATE' are deprecated and will be removed in a future release
This warning message is received when the date column is inserted or updated in MySQL if NO_ZERO_DATE or NO_ZERO_IN_DATE mode is used. This is because NO_ZERO_DATE and NO_ZERO_IN_DATE modes will be removed in future versions. To solve this problem, we need to modify the sql_mode setting of MySQL.
In MySQL's configuration file, find the settings item for sql_mode and remove the part that contains NO_ZERO_DATE and NO_ZERO_IN_DATE. For example, set the following:
sql_mode="ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES"
Modified to:
sql_mode="ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES"
After this setting, MySQL will no longer use NO_ZERO_DATE and NO_ZERO_IN_DATE modes to avoid error reports.
Through the above settings, some common MySQL errors can be solved to ensure the normal operation of the database.
This is the end of this article about MySQL [Warning] TIMESTAMP with implicit DEFAULT value is deprecated (Error Reporting Information Resolving). For more related contents of mysql error reporting, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!