错误:1449,“指定为定义者的用户('root'@'localhost')不存在" [英] Error: 1449, "The user specified as a definer ('root'@'localhost') does not exist"

查看:605
本文介绍了错误:1449,“指定为定义者的用户('root'@'localhost')不存在"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试通过我的应用程序检索数据或将数据插入数据库时​​,出现上述错误. proc代码如下

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 ;

但是,当我在sqlyog中运行以下查询时,它将返回1: SELECT EXISTS(SELECT 1 FROM mysql.user WHERE USER = 'root');

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

我正在使用XAMPP和Python制作我的应用程序. 预先感谢.

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

推荐答案

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

检查:指定为定义者的MySQL用户不存在 MySQL错误1449:用户指定为定义器不存在

这篇关于错误:1449,“指定为定义者的用户('root'@'localhost')不存在"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆