미스터 역마살

[Mysql 에러] 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) 본문

Database/MYSQL

[Mysql 에러] 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)

Mr. YeokMaSsal 2022. 7. 31. 12:50
728x90
반응형

 

에러 발생 이유

Mysql에서 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 특정 버전대에서 Super 권한이 없는 user에게서 발생할 수 있는 문제이다.

원인은 mysql global variable 중  log_bin_trust_function_creators 옵션이었다.

log_bin_trust_function_creators 옵션은 MySQL이 function, trigger 생성에 대한 제약을 강제할 수 있는 기능이다.

해당 옵션의 default는 OFF이며, OFF상태의 경우 권한이 있더라도 trigger를 생성할 수 없고, function을 생성할 수 없다.

결론적으로 해당 옵션이 OFF 상태일 경우, root 권한이 없는 user가 생성한 function을 일반 user가 실행할 수 없게된다.

 

해결방법

  1. 안정성 검증이 완료된 function을 super유저가 다시 생성하던가
  2. log_bin_trust_function_creators 옵션을 ON 시키는 방법으로 해결한다.
show global variables like 'log_bin_trust_function_creators';
SET GLOBAL  log_bin_trust_function_creators=ON;

 

 

 

 

728x90
Comments