美文网首页
mysql 批量修改视图定义者 DEFINER

mysql 批量修改视图定义者 DEFINER

作者: fordZrx | 来源:发表于2020-04-17 11:09 被阅读0次

原文: MySQL如何批量修改视图(VIEW)的属主(DEFINER)
参考: Mysql The user specified as a definer ('test'@'%') does not exist

在mysql数据库的迁移、备份恢复等操作时,有时会遇到错误:The user specified as a definer ('sdc'@'%') does not exist
这是视图的DEFINER属性造成的,修改即可:

1、生成修改语句

sql> select concat("alter DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `",TABLE_SCHEMA,"`.",TABLE_NAME," as ",VIEW_DEFINITION,";") from information_schema.VIEWS where DEFINER = 'sdc@%';
结果.png

2、复制执行即可

相关文章

网友评论

      本文标题:mysql 批量修改视图定义者 DEFINER

      本文链接:https://www.haomeiwen.com/subject/secevhtx.html