Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google CloudSQL 2nd Generation create Function not working

For a Google CloudSQL 2nd generation instance, with Failover replication was enabled. After that when tried to import the database it is not allowing to create the procedure. Receiving below error.

Error Code: 1419. 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)

Is it true that CloudSQL with failover will not support function ?

Sample execute query

DELIMITER ;;
CREATE FUNCTION `stutzen`(amount INT) RETURNS int(11)
    DETERMINISTIC
BEGIN
    DECLARE charges FLOAT DEFAULT 1.0;
    SELECT valuesettings INTO charges FROM dreamer_tbl WHERE namesettings='stutzen.co';
    RETURN FLOOR((amount / 100) * charges) ;
END ;;
DELIMITER ;
like image 886
arvindwill Avatar asked Sep 11 '25 18:09

arvindwill


1 Answers

You just need to set 'log_bin_trust_function_creators' to ON

To do it, open https://console.cloud.google.com

Select SQL

Select your instance

Select EDIT

DB signals

Add: log_bin_trust_function_creators on

general_log on

SAVE

like image 183
Cjs Avatar answered Sep 14 '25 11:09

Cjs