Today, the database user of a project was changed, and then the original user name was deleted and a new database name was replaced. Then the access to other pages of the website is normal, only one page that calculates the distance cannot be accessed. It has been reporting that the user does not exist, and the user name is the user name I deleted before, but the name of the database configuration file of my project has been changed. What's the matter? Please follow Jingxin to find out!
From the error message ERROR 1449 (HY000): The user specified as a definer ('xx'@'%') does not exist, it can be seen that there is no user xx@% in our database.
In my case there is indeed no, because I have replaced the database user name. But why did he prompt the previous username?
This is very strange.
Then the development side sent the sql statement that reported the error, and then studied it, and found that there was a call to a stored procedure in it.
In this way, it can basically be determined that there is a problem with the stored procedure, thinking that other tables can be queried normally, but the statement that uses the stored procedure function reports an error.
OK The reason is basically found, because the creator of the stored procedure is the previous user, but the previous user has been deleted, so when you call it again, you will be prompted that the user cannot be found.
The solution is also very simple, just log in to the user and recreate the stored procedure and it will be OK.
Well, the method has already told you how to operate it. I won’t talk about it, because the stored procedure of each project is different.
Let’s talk about the general process.
1. Check the object to which the stored procedure belongs: Right-click the stored procedure function——> select object properties——> check whether the function is created and belongs to the currently logged-in user
2. If not, back up the original stored procedure function and copy the stored procedure function For all the content in it, create a new stored procedure with the same name as before.
3. In this way, the creator belongs to the currently logged in user. If the original function is useless, it can be deleted directly.