Can't restore MySQL DB because of a function
Such DB migration is not obvious and you are not the first one to have trouble with functions and definers after importing DB as things have to be created in the right order.

I'm not sure to understand how you can grant right on a function to an user when this function failed to import so function wasn't created yet.

But instead of restarting restoration from the beginning, split your export in several files. fix the problem (create user analytic, create functions manually, if there is failure, don't use definer, you will fix the issue later after import completed) then continue execute export file from when it failed.