原因分析 因为创建视图使用的是root@%用户(目前已经不存在),然后登录用户使用的是test@localhost用户,导致mysql认为现在的test用户无权限访问该视图,解决方法就是在当前用户下test 重建该视图。 如果你是运维人员,此问题直接交由程序去处理,让其检查创建触发器、视图、存储过程等sql。如果包含root@%,替换之。重新创建。 结合一下命令,可以看个大概。 select `name` from mysql.proc where db = 'xxxxxx' and `type` = 'PROCEDURE' limit 5\G update mysql.event set definer='admin@%' where db='xxxxx‘; show events\G show procedure status; update mysql.proc set definer='admin@%' where db = 'xxxxxxxx' and `type` = 'PROCEDURE'; select * from information_schema.VIEWS limit 4\G show triggers\G show function status\G