Advertisement
11eimilia11

Grants

Feb 2nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.88 KB | None | 0 0
  1.  
  2. -- Usando a Base de Dados
  3. USE ichibasupermarket;
  4.  
  5. -- Criando usuário DBA e garantindo todos os privilégios
  6.  
  7. grant all
  8. on *.*
  9. to dba@localhost identified by '1234';
  10.  
  11.  
  12. -- Mostrando os privilégios do usuário DBA
  13.  
  14. show grants for dba@localhost;
  15.  
  16.  
  17. -- Garantindo privilégios de DIUS em todas as tabelas da Base de Dados
  18.  
  19. grant select , insert , update , delete
  20. on ichibasupermarket.*
  21. to dba@localhost;
  22.  
  23. -- Mosntrando os novos privilégios
  24.  
  25. show grants for dba@localhost;
  26.  
  27.  
  28. -- Criando provilégios de DBA
  29.  
  30. grant select , insert , update
  31. on ichibasupermarket.ferias
  32. to dba@localhost;
  33.  
  34. -- Criando usuário do tipo supervisor estoque
  35.  
  36. create user superEstoque@localhost identified by 'super1';
  37.  
  38. -- Garantindo os privilégios na tabela Produto_ref
  39. grant select , insert , update
  40. on ichibasupermarket.produto_ref
  41. to superEstoque@localhost;
  42.  
  43. -- Garantindo os privilégios na tabela Veículo
  44. grant select , insert , update, delete
  45. on ichibasupermarket.veiculo
  46. to superEstoque@localhost;
  47.  
  48. -- Garantindo privilégios na tabela Máquina
  49. grant select , insert , update , delete
  50. on ichibasupermarket.maquina
  51. to superEstoque@localhost;
  52.  
  53. -- Garantindo privilégios na tabela Promoção
  54. grant select , insert , update , delete
  55. on ichibasupermarket.promocao
  56. to superEstoque@localhost;
  57.  
  58. -- Criando o usuário tipo entregador
  59.  
  60. create user entregador@localhost identified by 'entregador';
  61.  
  62. -- Garantindo privilégios de inserir , atualizar e recuperar na tabela Incidente
  63.  
  64. grant select , insert , update
  65. on ichibasupermarket.incidente
  66. to entregador@localhost;
  67.  
  68. -- Criando usuário do tipo estoquista
  69.  
  70. create user estoquista@localhost identified by 'estoquista';
  71.  
  72. --  Mostrando os privilégios dos usuários
  73.  
  74. show grants for entregador@localhost;
  75.  
  76. show grants for dba@localhost;
  77.  
  78. show grants for superEstoque@localhost;
  79.  
  80. show grants for estoquista@localhost;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement