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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
| --------------
START TRANSACTION
--------------
--------------
SET PERSIST mandatory_roles = ''
--------------
--------------
commit
--------------
--------------
drop role if exists 'creator'@'localhost'
--------------
--------------
create role 'creator'@'localhost'
--------------
--------------
grant select,insert(titre,texte),update(titre,texte),delete on `base`.`vue_1` to 'creator'@'localhost'
--------------
--------------
grant select on `base`.`vue_2` to 'creator'@'localhost'
--------------
--------------
drop user if exists 'user1'@'localhost'
--------------
--------------
drop user if exists 'user2'@'localhost'
--------------
--------------
drop user if exists 'user3'@'localhost'
--------------
--------------
create user 'user1'@'localhost' IDENTIFIED by 'user1'
--------------
--------------
create user 'user2'@'localhost' IDENTIFIED by 'user2'
--------------
--------------
create user 'user3'@'localhost' IDENTIFIED by 'user3'
--------------
--------------
grant usage on *.* to 'user1'@'localhost'
--------------
--------------
grant usage on *.* to 'user2'@'localhost'
--------------
--------------
grant usage on *.* to 'user3'@'localhost'
--------------
--------------
grant 'creator'@'localhost' to 'user1'@'localhost'
--------------
--------------
grant 'creator'@'localhost' to 'user2'@'localhost'
--------------
--------------
grant 'creator'@'localhost' to 'user3'@'localhost'
--------------
--------------
SET DEFAULT ROLE ALL TO 'user1'@'localhost','user2'@'localhost','user3'@'localhost'
--------------
--------------
flush privileges
--------------
--------------
SHOW GRANTS FOR 'user1'@'localhost'
--------------
+----------------------------------------------------+
| Grants for user1@localhost |
+----------------------------------------------------+
| GRANT USAGE ON *.* TO `user1`@`localhost` |
| GRANT `creator`@`localhost` TO `user1`@`localhost` |
+----------------------------------------------------+
--------------
SHOW GRANTS FOR 'user2'@'localhost'
--------------
+----------------------------------------------------+
| Grants for user2@localhost |
+----------------------------------------------------+
| GRANT USAGE ON *.* TO `user2`@`localhost` |
| GRANT `creator`@`localhost` TO `user2`@`localhost` |
+----------------------------------------------------+
--------------
SHOW GRANTS FOR 'user3'@'localhost'
--------------
+----------------------------------------------------+
| Grants for user3@localhost |
+----------------------------------------------------+
| GRANT USAGE ON *.* TO `user3`@`localhost` |
| GRANT `creator`@`localhost` TO `user3`@`localhost` |
+----------------------------------------------------+
--------------
SHOW GRANTS FOR 'creator'@'localhost'
--------------
+-----------------------------------------------------------------------------------------------------------------------+
| Grants for creator@localhost |
+-----------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `creator`@`localhost` |
| GRANT SELECT, INSERT (`texte`, `titre`), UPDATE (`texte`, `titre`), DELETE ON `base`.`vue_1` TO `creator`@`localhost` |
| GRANT SELECT ON `base`.`vue_2` TO `creator`@`localhost` |
+-----------------------------------------------------------------------------------------------------------------------+
--------------
COMMIT
--------------
Appuyez sur une touche pour continuer... |
Partager