ERROR 1356 (HY000): View ‘viewname’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

This MySql (error ERROR 1356 (HY000): View ‘viewname’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them) occurs when a user tries to read data from a view that has been protected using the SQL SECURITY INVOKER clause while creating the view.

Creating view using the SQL SECURITY INVOKER clause.

CREATE 
SQL SECURITY INVOKER
VIEW system_users AS SELECT host,USER,password FROM mysql.USER;

Error occurs when user tries this command without having enough permissions:

SELECT * FROM system_users;

Error:

ERROR 1356 (HY000): View ‘system_users’ references invalid table(s)
or column(s) or function(s) or definer/invoker of view lack rights to use them

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.