Error: 1449, “The user specified as a definer ('root'@'localhost') does not exist”

試著忘記壹切 提交于 2019-12-13 16:05:03

问题


I get the above error when I try to retrieve data or insert data via my app to my database. The proc code is as follows

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_createUser`(
    IN p_name VARCHAR(20),
    IN p_username VARCHAR(20),
    IN p_password VARCHAR(20)
)
BEGIN
    if ( select exists (select 1 from tbl_user where user_username = p_username) ) THEN

        select 'Username Exists !!';

    ELSE

        insert into tbl_user
        (
            user_name,
            user_username,
            user_password
        )
        values
        (
            p_name,
            p_username,
            p_password
        );

    END IF;
END $$
DELIMITER ;

However, when I run the following query in my sqlyog it returns a 1: SELECT EXISTS(SELECT 1 FROM mysql.user WHERE USER = 'root');

I am using XAMPP and Python to make my app. Thanks in advance.


回答1:


grant all on *.* to 'root'@'%' identified by 'password' with grant option; 

Check: MySQL user specified as definer does not exist and MySQL error 1449: The user specified as a definer does not exist



来源:https://stackoverflow.com/questions/38361787/error-1449-the-user-specified-as-a-definer-rootlocalhost-does-not-exis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!