The MySQL function cannot be created by a workaround

Source: Internet
Author: User

MySQL function can not be created, is a very troublesome problem, the following gives you a solution to this problem, if you have encountered similar problems, may wish to see.

Http://database.51cto.com/art/201010/229918.htm

When using a MySQL database, you can sometimes encounter situations where MySQL functions cannot be created. Here is a solution to the MySQL function can not create a problem, for your reference.

The error message is roughly similar:

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

The MySQL function cannot be created and is not enabled:

  1. MySQL> Show variables like '%func% ';
  2. +---------------------------------+-------+
  3. | variable_name | Value |
  4. +---------------------------------+-------+
  5. | log_bin_trust_function_creators | OFF |
  6. +---------------------------------+-------+
  7. 1 row in Set (0.00 sec)
  8. MySQL> Set global log_bin_trust_function_creators=1;
  9. Query OK, 0 rows Affected (0.00 sec)
  10. MySQL> Show variables like '%func% ';
  11. +---------------------------------+-------+
  12. | variable_name | Value |
  13. +---------------------------------+-------+
  14. | log_bin_trust_function_creators | On |
  15. +---------------------------------+-------+
  16. 1 row in Set (0.00 sec) MySQL>

==================

http://blog.csdn.net/ciwei007/article/details/15635151

1. Create a custom function in MySQL error message as follows:

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

Workaround:

Mysql>set Global Log_bin_trust_function_creators=1;

Source Document

2. When creating function

Error message:

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

Reason:

This is when we open the bin-log and we have to specify whether our function is

1 Deterministic indeterminate

2 No SQL does not have SQL statements and of course does not modify the data

3 READS SQL Data just reads and of course does not modify the data

4 modifies SQL data to modify

5 CONTAINS SQL contains SQL statements

Within the function, only deterministic, NO SQL, and READS SQL DATA are supported. If we open the Bin-log, we must specify a parameter for our function.

The workaround for this error occurs when creating a function in MySQL:

Set global log_bin_trust_function_creators=true;

Source Document

3.

Error when importing data to MySQL

Error message:

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

Reason:

This is when we open the bin-log and we have to specify whether our function is

1 Deterministic indeterminate

2 No SQL does not have SQL statements and of course does not modify the data

3 READS SQL Data just reads and of course does not modify the data

4 modifies SQL data to modify

5 CONTAINS SQL contains SQL statements

Within the function, only deterministic, NO SQL, and READS SQL DATA are supported. If we open the Bin-log, we must specify a parameter for our function.

Workaround:

SQL Code

Mysql> Show variables like '%func% ';

+---------------------------------+-------+

| variable_name | Value |

+---------------------------------+-------+

| log_bin_trust_function_creators | OFF |

+---------------------------------+-------+

1 row in Set (0.00 sec)

mysql> set global Log_bin_trust_function_creators=1;

Query OK, 0 rows Affected (0.00 sec)

Mysql> Show variables like '%func% ';

+---------------------------------+-------+

| variable_name | Value |

+---------------------------------+-------+

| log_bin_trust_function_creators | On |

+---------------------------------+-------+

1 row in Set (0.00 sec)

Source Document

4.

Today we are going to write a function. But there is no way to build a hint error as follows:

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

Solution: (Edit my.cnf, add the following)

[Mysqld]

Log_bin_trust_routine_creators = 1

It's good to restart MySQL.

Humen1 Tech

Source Document

The MySQL function cannot be created by a workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.