zoukankan      html  css  js  c++  java
  • mysql 权限

    问题描述: 
    Mysql中UserA 调用UserB的函数时遇到 
    [Err] 1370 - execute command denied to user ‘test’@’127.0.0.1’ for routine ‘lw.historynextval’

    查看UserA的权限 
    mysql> show grants for UserA@192.168.10.61; 
    GRANT EXECUTE ON FUNCTION lw.historynextval TO ‘UserA’@’192.168.10.61’

    UserA调用UserB的函数,返回[Err] 1370,Why? 
    mysql -uUserA -p -h 127.0.0.1 -P 3316 -e “select lw.historynextval()” 
    [Err] 1370 - execute command denied to user ‘test’@’127.0.0.1’ for routine ‘lw.historynextval’

    用UserB调用自己定义的函数,返回ERROR 1370 (42000) 
    mysql -uUserB -p -h 127.0.0.1 -P 3316 -e “select lw.historynextval()” 
    Enter password: 
    ERROR 1370 (42000) at line 1: execute command denied to user ‘test’@’127.0.0.1’ for routine ‘lw.historynextval’

    从错误的描述来看是,UserB没有执行自己定义函数的权限

    授权给UserB执行函数的权限 
    GRANT EXECUTE ON lw.* TO ‘test’@’127.0.0.1’;

    用UserB调用自己定义的函数,成功。 
    mysql -utest -p -h 127.0.0.1 -P 3316 -e “select lw.historynextval()” 
    Enter password: 
    +———————+ 
    | lw.historynextval() | 
    +———————+ 
    | 21 | 
    +———————+

    UserA调用UserB的函数,成功。 
    mysql -uUserA -p -h 127.0.0.1 -P 3316 -e “select lw.historynextval()” 
    +———————+ 
    | lw.historynextval() | 
    +———————+ 
    | 22 | 
    +———————+

    Mysql中调用其它用户定义的函数时: 
    1.首先要确保函数的定义者有执行自己定义函数的权限。 
    如:用户A,创建了函数fun1。首先要保证用户A能调用函数fun1.

    2.函数的调用者要有调用函数的权限 
    用户B要调用A用户定义的函数fun1,要确保用户B被授权调用A用户的函数

    3.如果函数中涉及到对相关表的权限,也要授予函数的调用者。

  • 相关阅读:
    python 函数function
    安装python 第三方库遇到的安装问题 microsoft visual studio c++ 10.0 is required,Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    Pandas库入门
    pyplot基础图表函数概述
    Matplotlib库介绍
    Numpy数据存取与函数
    NumPy库入门
    css3知识
    HTML标签marquee实现滚动效果
    JQuery导航选择特效
  • 原文地址:https://www.cnblogs.com/Struts-pring/p/5148153.html
Copyright © 2011-2022 走看看