mysqltriggers

Permissions for creating a trigger in mysql


mysql ver is 5.0.67

my trigger code is :

DELIMITER //
CREATE TRIGGER upd_price BEFORE UPDATE ON product_price
 FOR EACH ROW BEGIN  
    INSERT INTO update_price_log (product_id, product_price_old, product_price_new) values(OLD.product_id, OLD.product_price, NEW.product_price);
END
//
DELIMITER ;

error is:

#1227 - Access denied; you need the SUPER privilege for this operation

my server, is not cpanel! it is : DirectAdmin Web Control Panel.

how can i create SUPER privilege and create my trigger?


Solution

  • You must have MySQL Root privileges to set the SUPER permission for a user.

    GRANT SUPER 
    ON '<database>'.'<tablename/*>' 
    TO '<username>'@'<host/connection/ip/%>';