After the MySQL stored procedure is migrated to the cloud, an error may occur when the stored procedure or function is invoked due to permission problems.
The method varies with Definer policies. This section uses user1 as an example to describe how to solve this problem in two Definer policies.
On the Destination Database page, enter the database username user1, and select OK for Migrate Definer to User.
In this policy, after the Definers of all stored procedures and methods in the source database are migrated to the destination database, the account is automatically changed to user1, and the value of host is automatically changed to %. If a stored procedure fails to be invoked in the destination database, perform the following operations:
GRANT EXECUTE ON db.* TO user;
GRANT SELECT ON mysql.proc TO 'user'@'%';
On the Destination Database page, enter the database username user1, and select Cancel for Migrate Definer to User.
In this policy, the account and host in the source database remain unchanged after the Definers of all stored procedures and methods are migrated to the destination database. You need to migrate all users in the source database by referring to Migrating Accounts. In this way, the permission system of the source database remains unchanged.
If you do not migrate account permissions or some accounts cannot be migrated, you are advised to use Policy 1.