Home  >  Article  >  Database  >  Solve the problem of mysql error This function has none of DETERMINISTIC

Solve the problem of mysql error This function has none of DETERMINISTIC

藏色散人
藏色散人forward
2021-06-04 11:49:034256browse

This article will introduce to you the solution to mysql error This function has none of DETERMINISTIC. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

This article introduces to friends how to open the bin-log log mysql error: This function has none of DETERMINISTIC, NO SQL solution,

When creating a stored procedure

Error message:

ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

Cause:

This is because we have opened the bin-log, we must specify whether our function is

1 DETERMINISTIC 不确定的
2 NO SQL 没有SQl语句,当然也不会修改数据
3 READS SQL DATA 只是读取数据,当然也不会修改数据
4 MODIFIES SQL DATA 要修改数据
5 CONTAINS SQL 包含了SQL语句

In the function, there is only DETERMINISTIC , NO SQL and READS SQL DATA are supported. If we enable bin-log, we must specify a parameter for our function.

Solution:

SQL code
mysql> show variables like 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name          | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | OFF  |
+---------------------------------+-------+
mysql> set global log_bin_trust_function_creators=1;
mysql> show variables like 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name          | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | ON  |

After adding the parameter in this way, if mysqld restarts, the parameter will disappear again, so remember to add:

log_bin_trust_function_creators=1

in the my.cnf configuration file Recommended: "mysql video tutorial"

The above is the detailed content of Solve the problem of mysql error This function has none of DETERMINISTIC. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete