导入sql脚本时遇到的错误

48 阅读1分钟

1.在创建自定义函数时遇到错误:

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)

原因: 导致该错误的原因可能是一个安全设置方面的配置,查手册log_bin_trust_function_creators参数缺省0,是不允许function的同步 解决:

set global log_bin_trust_function_creators = 1;

2.Error Code: 1449. The user specified as a definer ('root'@'%') does not exist

原因: 没有权限

解决: 执行命令,将权限赋给root

grant all privileges on *.* to 'root'@'%' identified by ".";
flush privileges;#记得刷新

注: Mysql8.0不支持grant all privileges on . to root@“%“ identified by “.“; 报错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by "."' at line 1

CREATE USER 'root'@'%' IDENTIFIED BY 'name!!';//先创建用户
grant all privileges on *.* to 'root'@'%' ;//再给用户授权
refa