MySQL: The user specified as a definer (' '@'%') does not exist

今天在运行程序的时候得到错误:

Caused by: java.sql.SQLException: The user specified as a definer ('ipdown'@'%') does not exist

在数据库中查看是一个视图的问题。视图创建的语句都是从服务器上直接备份过来的,所以视图定义也用的服务器上的数据库用户

可以用

SHOW CREATE VIEW `dbName`.`viewName`;来查看。

定义为:

CREATE ALGORITHM=UNDEFINED
DEFINER=`ipdown`@`%`
SQL SECURITY DEFINER VIEW `viewName` AS select.......

在本地库运行:

ALTER ALGORITHM=UNDEFINED 
DEFINER=`root`@`localhost` 
SQL SECURITY DEFINER VIEW `viewName` AS select.......

就解决了。上面的root和localhost要根据实际情况进行修改。

 

参考:

http://blog.handone.com/index.php/archives/137

posted @ 2017-09-13 16:38  Jane&Coding  阅读(287)  评论(0)    收藏  举报