zoukankan      html  css  js  c++  java
  • mysql删除用户账户后的影响,mysqldump: Got error: 1449: The user specified as a definer ('someuser'@'%') does not exist when using LOCK TABLES

    【1】问题

      再确认这个账户只是用户使用,而不是程序使用之后;

    当我们删除一个用户账户后,有一个很蛋疼的情况,那就是函数/触发器/存储过程等 定义所属是该用户时,就会导致其他所有账户无法访问;

    访问已删除账户所属的 SP、view、func 等数据库对象时,就会报错 权限不允许,或者 直接报 xxx(被删除的账户)账户已经不存在。

    mysqldump时也会报错:mysqldump: Got error: 1449: The user specified as a definer ('someuser'@'%') does not exist when using LOCK TABLES

    【2】解决

    我们通过系统表,把这些对象 全部alter 一遍,把 拥有者修改为不会删除的 root 账户 或 指定账户

    这里以视图为例,把被删除的用户名放到最后的 where DEFINER  = 'user@host'

    select concat("alter DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW ",TABLE_SCHEMA,".",TABLE_NAME," as ",VIEW_DEFINITION,";") from information_schema.VIEWS where DEFINER = '';

    其他的比如函数、存储过程等,这里就不一 一 举例了,自行修改即可

    select TABLE_SCHEMA, TABLE_NAME, DEFINER from information_schema.VIEWS;

    【参考文档】

    https://www.cnblogs.com/martinding/p/7457701.html

  • 相关阅读:
    npm install报错Error: ENOENT
    hibernate hql
    mysql授权
    撤销git reset soft head操作
    nodejs&npm等概念梳理
    Java类中中文问题
    采用MANIFEST.MF之jar报错ClassNotFoundException解法
    EChart和G2比较
    牛客OI测试赛1
    Codeforces Round #340 (Div.2)
  • 原文地址:https://www.cnblogs.com/gered/p/14000595.html
Copyright © 2011-2022 走看看