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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| show grants;
# MySQL Workbench에서 실행하면 보기 편함 select * from mysql.user;
select host, user from mysql.user;
select host, user, select_priv from mysql.user;
select host, user, create_user_priv from mysql.user; select host, user, super_priv, create_user_priv, grant_priv, show_view_priv from mysql.user;
######################### create user backend identified by 'mysql3456'; show grants for backend; select host, user, super_priv, create_user_priv, grant_priv, show_view_priv from mysql.user;
drop user backend;
select host, user, super_priv, create_user_priv, grant_priv, show_view_priv from mysql.user;
show grants for backend; #########################
# create user backend@localhost identified by 'mysql3456';
# select host, user, super_priv, create_user_priv, grant_priv, show_view_priv from mysql.user;
# show grants for backend; # show grants for backend@*;
# drop user backend@localhost;
#########################
quit
# Shell에서 실행 # mysql -u backend -p
show grants;
#########################
grant all privileges on *.* to root@'%' identified by 'mysql1234'; #delete from mysql.user where host="localhost" and user="root"; flush privileges; select host, user, super_priv, create_user_priv, grant_priv, show_view_priv from mysql.user; quit # open /etc/mysql/my.cnf # 이 파일이 다른 파일 include
# vim /etc/mysql/mysql.conf.d/mysqld.cnf
#########################
rename user backend to webroot; select host, user, super_priv, create_user_priv, grant_priv, show_view_priv from mysql.user;
drop user webroot; select host, user, super_priv, create_user_priv, grant_priv, show_view_priv from mysql.user;
grant all privileges on *.* to root@localhost identified by 'mysql1234';
show databases; grant select on songdb.song to backend;
#################
show databases; use songdb; select * from song;
INSERT INTO song VALUES ('임창정', '소주한잔'); select * from song;
grant insert on songdb.song to backend; show grants for backend;
use songdb; select * from song; INSERT INTO song VALUES ('임창정', '소주한잔'); select * from song;
### revoke all privileges, grant option from backend; show grants for backend;
|