Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Apr 2009
    Posts
    14

    Default MySQL problem. Using CREATE FUNCTION

    I have a problem when one of my customers tries to create his own sql example function.
    According to the MySQL manual the only privileges needed to do so is the CREATE ROUTINE privilege. The ALTER ROUTINE and EXECUTE privileges will be granted automatically (see http://dev.mysql.com/doc/refman/5.1/...procedure.html).

    The problem is the MySQL fails to grant the ALTER ROUTINE and EXECUTE privileges:
    Code:
    MySQL (***@***.**): 2009-04-17 15:41:47: 1404: Failed to grant EXECUTE and ALTER ROUTINE privileges
    MySQL (***@***.**): 2009-04-17 15:41:47: 1410: You are not allowed to create a user with GRANT
    It seems MySQL tries to do something in the background that is not mentioned in the manual. I think it may be something with MySQL not supporting user privileges to different databases and CPanel uses a workaround for this (by forcing db and dbuser names to contain the CPanel username).

    Does someone have a clue?
    Is it possible to create your own functions in MySQL under CPanel or is it impossible with how it is implemented?

    The customers test code:
    Code:
    CREATE FUNCTION [mysql-username].WEIGHTED_AVERAGE (
    	n1 INT,
    	n2 INT,
    	n3 INT,
    	n4 INT
    )
    RETURNS INT
    DETERMINISTIC
    
    BEGIN
    	DECLARE avg INT;
    	SET avg = (n1+n2+n3*2+n4*4)/8;
    	RETURN avg
    END
    Last edited by Svintoo; 04-24-2009 at 10:48 AM.

  2. #2
    Member tuxicans's Avatar
    Join Date
    Oct 2008
    Posts
    38

    Default

    cPanel mysql management does not have a privilege ROUTINE in its list of privileges. Please contact your hosting support team to add this privilege for the database user from server backend.
    Tuxicans
    24x7 Webhosting Support
    24x7 Server Administration

Similar Threads & Tags
Similar threads

  1. Problem to create backup of mysql database!
    By myxp in forum Database Discussions
    Replies: 0
    Last Post: 12-25-2010, 04:40 AM
  2. Disable Create Function on PhpMyAdmin
    By skyknight in forum Database Discussions
    Replies: 1
    Last Post: 11-15-2010, 03:38 PM
  3. Function for Create FTP Account,EMAIL,MYSQL Database
    By weblizzer in forum cPanel Developers
    Replies: 5
    Last Post: 03-30-2009, 03:18 PM
  4. create account function VERY SLOW
    By Jayreis in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-24-2009, 03:10 PM
  5. MySQL password function
    By brianc in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-29-2006, 06:03 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube