---
title: "MySQL数据库开启或关闭函数功能"
author: "yang8820"
date: "2012-01-30T13:59:06Z"
tags: []
categories: ["数据库"]
slug: "mysql"
draft: false
lastmod: "2013-10-14T11:24:10Z"
id: 1383350
url: "https://yang8820.iteye.com/blog/1383350"
---

应用MySQL时，会遇到不能创建函数的情况。出现如下错误信息：  
ERROR 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)  
那是因为没有将功能开启。

开启MySQL函数功能：SET GLOBAL log\_bin\_trust\_function\_creators=1;

关闭MySQL函数功能：SET GLOBAL log\_bin\_trust\_function\_creators=0;

查看状态：show variables like '%func%';

 

要使此设置永久有效：

windows 下my.ini\[mysqld]中加上log\_bin\_trust\_function\_creators=1