1. Event background
Today, when the lunch point approached, the development colleague sent a request to create two views in the MARIADB library, requiring the specified account to have read-only permissions.
Very simple requirements, connected to the server, two grant command a brush, fulsh privileges Enter, landlord on the safe to eat.
2. The emphasis came, waiting for the landlord to return, (also in the downstairs played the King pesticide, platoon two even kneel (┬_┬)),
I was called in by my colleague in the morning.
3. Steady
Instant Circle of me, back to a moment, and then hurriedly to check the reason.
After repeatedly confirming grant no problem, the landlord continued to circle. At this point the distance to this question, has been 20 minutes,
Very anxious Ah, clearly a small demand how can this.
In the landlord extremely helpless, suddenly point to the design view of the Advanced page, see the security ' definer ' this point.
A certain degree of omnipotence gave me the answer, when the security of the view is Definer, the database exists definer the specified user, that is, the definition in the diagram is filled in. And the user has the corresponding permissions to execute. Regardless of whether the current user has permissions.
When the security of a view is invoker, execution can succeed as long as the performer has execute permissions.
I modified the problem resolution after the diagram, because it was written ' [email protected]%.% ' and the security of the view is definer caused. Of course, if the development is not a specified account read-only, you can also invoker the security definition, so long as there are permissions to this view can be viewed.
Reference: http://pdf.us/2018/02/24/679.html
MySQL view permission settings for Stomp Experience