Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mysql

sqlyog

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.

like image 515
Oreo Avatar asked Jul 13 '16 21:07

Oreo


1 Answers

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

like image 174
Liv Avatar answered Sep 21 '22 15:09

Liv