当前位置: 移动技术网 > IT编程>数据库>Mysql > MYSQL设置触发器权限问题的解决方法

MYSQL设置触发器权限问题的解决方法

2017年12月12日  | 移动技术网IT编程  | 我要评论

本文实例讲述了mysql设置触发器权限的方法,针对权限错误的情况非常实用。具体分析如下:

mysql导入数据提示没有super privilege权限处理,如下所示:

error 1419 (hy000): you do not have the super privilege and binary logging is enabled

导入function 、 trigger 到 mysql database,报错:

you do not have the super privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)”.

原因:
function / trigger 中有dangerous statements修改数据库,错误只在启用binary logging选项进行主从复制的服务器上出现。

解决方法如下:

1)导入数据的用户不仅需要create routine, alter routine, create trigger, alter trigger, create function 和 alter function 权限,还需要super privileges 权限,使用超级用户导入数据。

2)让所有用户具有执行类似functions的权限,危险,不推荐,

 o by specifying it on the server start, like: –log-bin-trust-function-creators=1
 o by setting it to 1 through the set global statement, like:
mysql> set global log_bin_trust_function_creators = 1;

3)如果不需要复制,或者是从库,关闭binlog,

# binary logging – not required for slaves, but recommended
#log-bin=mysql-bin
# binary logging format – mixed recommended
#binlog_format=mixed

希望本文所述对大家的mysql数据库设计有所帮助。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网