Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL user specified as definer does not exist

Tags:

php

mysql

web

I am trying to call a stored procedure with php. The previous day this was working, but today i get an error that "The user specified as a definer ('name of the user'@'my ip the previous day') does not exist"

The procedure is located in a host and i grant to my ip access through cpanel's remote MySql. The code that i used is correct and taken from here http://www.php.net/manual/en/mysqli.quickstart.stored-procedures.php

Does the error occur because my ip is different today, even though i have access again? How can i solve it?

like image 677
user1860935 Avatar asked Nov 24 '13 10:11

user1860935


People also ask

How do I get MySQL definer?

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.

What is Definer in MySQL?

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.

How do I give permission to MySQL database?

To GRANT ALL privileges to a user , allowing that user full control over a specific database , use the following syntax: mysql> GRANT ALL PRIVILEGES ON database_name. * TO 'username'@'localhost';


2 Answers

If you've found following error while using mysql database: The user specified as a definer ('root'@'%') does not exist Then you can solve it by using following :

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

Credit to http://www.lynnnayko.com/2010/07/mysql-user-specified-as-definer-root.html

like image 150
Poomrokc The 3years Avatar answered Oct 21 '22 03:10

Poomrokc The 3years


The user that created the procedure must've been deleted. Since your user id is mapped to an ip address, the change of the IP is most probably the cause. If you can recreate the user, that would work.

or, try this:

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

This is a slightly insecure way to handle it, but if its just local biz, it shouldn't be a problem.

Source: http://www.lynnnayko.com/2010/07/mysql-user-specified-as-definer-root.html

like image 32
sidegeeks Avatar answered Oct 21 '22 05:10

sidegeeks