Recent Topics

[Solved] "CREATE DEFINER" issue in shared hosting



  • i just installed and ran bagisto in localhost and its working fine, but when i upload sql dump in cpanel (shared hosted) it throws following error

    CREATE DEFINER=`user`@`localhost` FUNCTION `get_url_path_of_category` (`categoryId` INT, `localeCode` VARCHAR(255)) RETURNS VARCHAR(255) CHARSET utf8mb4 BEGIN
    ------
    ------
    
    #1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation
    

    table collation is also set to "utf8_unicode_ci"

    tried to grant super privilege but it is also not allowed by hosting, thows below error

    GRANT SUPER ON bagisto.* TO [email protected]'localhost'
    MySQL said: Documentation
    
    #1045 - Access denied for user 'root'@'localhost' (using password: YES)
    

    removing the above function successfully uploads sql file but throws error while adding categories

    SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION bagisto.get_url_path_of_category does not exist (SQL: update `categories` set `_lft` = case when `_lft` >= 19 then `_lft`+2 else `_lft` end, `_rgt` = case when `_rgt` >= 19 then `_rgt`+2 else `_rgt` end where (`_lft` >= 19 or `_rgt` >= 19))
    

    i dont have ssh access to the server, its a normal shared hosting
    is there a way i can run bagisto without stored procedure



  • Try to remove the DEFINER from your function like below:

    CREATE  FUNCTION `get_url_path_of_category` (`categoryId` INT, `localeCode` VARCHAR(255)) RETURNS VARCHAR(255) CHARSET utf8mb4 BEGIN
    
    


  • I was trying to remove the whole function. lol

    Removed the word "DEFINER" as you said and it works like a charm. Thanks 🙂


Log in to reply