Pages

Thursday, May 28, 2015

MySQL Error Code: 1418. 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)

When I transferring MySQL Local Server Database to Remote MySQL Server using HeidiSQL Export. HeidiSQL produce error "Error Code: 1418. 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)" while try to transfer MySQL Functions.

MySQL Server had "Binary Logging of Stored Programs" option which cause for this error. The binary log contains information about SQL statements that modify database contents. This information is stored in the form of events that describe the modifications. The binary log has two important purposes:For replication and Certain data recovery operations

However, there are certain binary logging issues that apply with respect to stored programs (stored procedures and functions, triggers, and events), if logging occurs at the statement level:

1, A statement will affect different sets of rows on a master and a slave.
2, Replicated statements executed on a slave which has full privileges
3, If a stored program that modifies data is non deterministic

Solutions:

1, You must declare either that it is deterministic or that it does not modify data. Otherwise, it may be unsafe for data recovery or replication while creating stored procedures and functions, triggers, and events

2,  To relax the preceding conditions on function creation. Set the global log_bin_trust_function_creators system variable to 1. By default, this variable has a value of 0, but you can change it like this:

 mysql> SET GLOBAL log_bin_trust_function_creators = 1;

No comments:

Post a Comment