I have searched on this problem a lot but could not find solution.
I am using stored procedure:
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `GetImages`(
in search Varchar(80)
)
BEGIN
select
image_path
from check_images
where checkNumber=search;
END
It is not working in localhost and getting following Error:
Error Number: 1449
The user specified as a definer ('root'@'%') does not exist
But if I replace % sign with "localhost" ('root'@'localhost') then everything works perfect. Also I am not allowed to alter the stored procedure. So please tell me the best solution that how can I overcome this problem.
I'll appreciate any help.
Thanks
To identify which DEFINER values exist in each table, use these queries: SELECT DISTINCT DEFINER FROM INFORMATION_SCHEMA. EVENTS; SELECT DISTINCT DEFINER FROM INFORMATION_SCHEMA. ROUTINES; SELECT DISTINCT DEFINER FROM INFORMATION_SCHEMA.
The DEFINER clause specifies the MySQL account to be used when checking access privileges at routine execution time for routines that have the SQL SECURITY DEFINER characteristic.
In this stored procedure, the definer is root@localhost that is the superuser which has all privileges. The SQL Security is set to the definer. It means that any user account which calls this stored procedure will execute with all privileges of the definer i.e., root@localhost user account.
DEFINER is the account specified as the DEFINER when the stored routine or view was created (see the section above). INVOKER is the account invoking the routine or view. As an example, let's assume a routine, created by a superuser who's specified as the DEFINER , deletes all records from a table.
The message is quite clear that user does not exist.
In MySQL a user account consists of both the user name and the host definition component.
Either change the definer to 'root'@'localhost'
or create a user for 'root'@'%'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With