In mysql, you have the following permissions to edit or delete a stored procedure: alter routine, create routine, and EXECUTE, next I will introduce you to a problem I encountered.
The creator of a stored procedure has the ALTER, CREATE, and EXECUTE permissions for the stored procedure.
When there is a stored procedure in the database imported through mysql, the stored procedure cannot be used by the program after the import. After a long time, the cause is found to be a permission issue.
1. We need to view the stored procedures in the database: Enter
The Code is as follows: |
Copy code |
Mysql> show function status; |
Result After running:
2. Modify the values of the Definer and Security_type fields of the stored procedure.
The account used to join our program to connect to the database is leiming, and the address used to connect to the database is 127.0.0.1.
We need to enter
The Code is as follows: |
Copy code |
Mysql> update mysql. proc set Definer = 'leiming @ 127.0.0.1 '; |
Then modify the Security_type field:
The Code is as follows: |
Copy code |
Mysql> update mysql. proc set Security_type = 'invoker '; |
Here we are modifying all the stored procedures. Of course, you only need to add the where condition to modify the stored procedure.