Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags more
Archives
Today
Total
관리 메뉴

맨땅에 코딩

[mysql] 특정 프로시저 생성/수정/실행 권한 부여 본문

DB

[mysql] 특정 프로시저 생성/수정/실행 권한 부여

맨땅 2023. 1. 4. 15:33

목차

    반응형

     

     

    1. MariaDB 접속

    [root@localhost mysql]# mysql -u root -p
    Enter password:
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 22
    Server version: 10.4.17-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>

     

    2. 접속 계정 생성 및 DB 권한 할당 

    # 계정 생성
    MariaDB [(none)]> create user test@'%' identified by 'P@ssw0rd';
    Query OK, 0 rows affected (0.004 sec)
    
    #데이터 베이스 생성
    MariaDB [(none)]> create database testdb;
    Query OK, 1 row affected (0.000 sec)
    
    # test계정에 testdb 권한 할당
    MariaDB [(none)]> use testdb
    Database changed
    MariaDB [testdb]> GRANT ALL privileges ON testdb.* TO test@'%';
    Query OK, 0 rows affected (0.002 sec)
    
    MariaDB [testdb]> flush privileges;
    Query OK, 0 rows affected (0.000 sec)

     

    3. 프로시저 생성 및 수정 권한 부여

    GRANT CREATE, ALTER ROUTINE ON DB명.* TO 'user_id';
    FLUSH PRIVILEGES;

     

    4. 특정 프로시저 실행 권한 주기 

    GRANT EXECUTE ON PROCEDURE `db_name`.`procedure_name` TO 'user_id'@'host' ;
    FLUSH PRIVILEGES;

    만약!! 여기서 막히신다면 (제가 그랬습니다) 프로시저가 아닌 함수가 아닌지 확인하셔야 합니다!! 

     

    저는 return 값이 있는 함수였는데 FUNCTION으로 표기안해서 계속 안됐었습니다!! (몇시간 삽질함..)

     

     

    5. 프로시저가 아니라 함수일 경우 ***

    GRANT EXECUTE ON FUNCTION db_name.function_name TO name@'%';

    구분자 없이 맞게 입력해주시면 됩니다

     

    name = 계정 이름 입니다

     

     

    6. 프로시저 권한 삭제

    REVOKE EXECUTE ON db_name.procedure_name FROM name;

     

    7. 권한 확인

    show grants for name@'%';

     

     

     

     

     

     

    겪은 에러들...

     

    [MYSQL] FUNCTION, PROCEDURE DOESN'T NOT EXIST

    procedure does not existprocedure does not exist

     

     


     

     

    참고 블로그

    https://emptyreset.tistory.com/25

     

    MariaDB 원격 접속 허용하기

    MariaDB 서버 : 192.168.60.15 Clinet IP : 192.168.60.5 1. MariaDB 접속 [root@localhost mysql]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 22 Server version: 10.4.17-MariaDB M

    emptyreset.tistory.com

    https://it-sunny-333.tistory.com/81#recentComments

     

    [mysql] 프로시저 생성/수정/실행 권한 주기

    1. 프로시저 생성 및 수정 권한 주기 GRANT CREATE, ALTER ROUTINE ON DB명.* TO 'user_id'; FLUSH PRIVILEGES; 2. 특정 프로시저 실행 권한 주기 GRANT EXECUTE ON PROCEDURE `db_name`.`procedure_name` TO 'user_id'@'host' ; FLUSH PRIVILEGES;

    it-sunny-333.tistory.com

    https://gent.tistory.com/538?category=360526 

     

    [Oracle] 프로시저(Procedure) 권한 부여 방법

    오라클에서 타 스키마에 생성된 프로시저의 사용 권한 또는 실행 권한을 부여하기 위해서는 "GRANT EXECUTE" 구문을 사용한다. "프로시저 권한이 불충분합니다"라는 오류 메시지가 발생하면 실행 권

    gent.tistory.com

    반응형