DCL
데이터 제어 언어
Data Control Language
주요명령어
GRANT
REVOKE
-- DCL 데이터 제어 언어
-- 현재 root 계정 (최고관리자)
create database mydb2;
use mydb2;
-- 사용자 생성 및 비밀번호 설정
-- 로컬에서만 접근 가능한 계정 user1 생성
-- 버전 5와 8의 명령어가 다르다. 현재 8 사용중
create user 'user1'@'localhost' identified by 'password123';
-- user1에 조회 권한만 부여해보자.
grant select on school.student to 'user1'@'localhost';
-- user1 계정 조회 권한 회수
revoke select on school.student from 'user1'@'localhost';
-- 원격 및 로컬에서 접근 가능한 id 생성과 권한부여
create user 'user2'@'%' identified by 'password123';
create user 'user2'@'localhost' identified by 'password123';
-- 권한 부여
grant select, insert, update, delete on school.student to 'user2'@'%';
grant select, insert, update, delete on school.student to 'user2'@'localhost';
'MySQL' 카테고리의 다른 글
SQL 문법) ANSI 표준 ANSI 함수 (1) | 2025.05.16 |
---|---|
SQL 문법 JOIN, 여러 테이블의 데이터를 합치기 (0) | 2025.05.14 |
SQL 문법, 데이터타입 (0) | 2025.05.13 |
SQL 문법, DML 데이터 조작 언어 (입력 조회 수정 삭제) (0) | 2025.05.13 |
SQL 문법, DDL 데이터 정의 언어 (DB/테이블/칼럼 편집) (0) | 2025.05.13 |