'definer/invoker of view lack rights to use them

When I import my database all the tables are imported successfully, but when I'm trying to access the "views" then I got the message below on phpmyadmin's screen

references invalid table(s) or column(s) or function(s) 
or definer/invoker of view lack rights to use them

Please tell me what is wrong there?



Solution 1:[1]

This is caused when importing a view into a new database. Unlike table, when importing view it includes previous host line as follows

CREATE ALGORITHM=UNDEFINED DEFINER=`previoushost`@`localhost`
    SQL SECURITY DEFINER VIEW `view_user`  
    AS SELECT `user`.`id`,`user`.`name` ....

Now Backup this view(incase something happens), and DROP IT and create it as

CREATE VIEW `view_user`  
    AS SELECT `user`.`id`,`user`.`name` .....

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aman