본문 바로가기
즐거운 컴퓨터 생활/이럴땐 이렇게

MySQL View Table 생성 및 유저 권한 할당

by 만수킴 2020. 11. 9.
CREATE VIEW view_table_name AS
SELECT 
	s.*, a.*
FROM aaa_table AS a
INNER JOIN sss_table AS s ON s.tmp_id = a.tmp_id
WHERE s.del_yn = 'N';
  
SELECT * FROM h_database_name.v_table_name;

CREATE USER 'user_name'@'%' IDENTIFIED BY 'user_pw';
SELECT * FROM mysql.user;
GRANT SELECT ON m2_hunnov.view_table_name TO 'user_name'@'%';
SELECT * FROM mysql.user;
FLUSH PRIVILEGES;

댓글