Guest User

Untitled

a guest
Mar 1st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. CREATE USER 'user1'@'%' IDENTIFIED BY 'student';
  2.  
  3. GRANT USAGE on *.* to 'user2'@'%' IDENTIFIED BY 'student'; ('%') // WSZYSTKIE HOSTY
  4.  
  5. grant all privileges on db3.* to user3;
  6.  
  7. CREATE USER 'root2'@'%' IDENTIFIED BY 'student';
  8.  
  9. grant all privileges on *.* to 'root2' with grant option;
  10.  
  11. create database db1;
  12. create database db2;
  13.  
  14. grant all privileges on db1.* to user1;
  15. grant all privileges on db2.* to user2;
  16.  
  17. SET PASSWORD FOR 'user1'@'localhost'=PASSWORD('student2')
  18. SET PASSWORD FOR 'user2'@'localhost'=PASSWORD('student2')
  19.  
  20. revoke all privileges on db3.* from user3;
  21.  
  22. use db1;
  23. create table tabela1(id int auto_increment, Imie varchar(30),Adres varchar(30), Telefon varchar(9), Email varchar(40), primary key(id));
  24. create table tabela2(id int auto_increment, Imie varchar(30),Adres varchar(30), Telefon varchar(9), Email varchar(40), primary key(id));
  25.  
  26. use db2;
  27. create table tabela3(id int auto_increment, Imie varchar(30),Adres varchar(30), Telefon varchar(9), Email varchar(40), primary key(id));
  28. create table tabela4(id int auto_increment, Imie varchar(30),Adres varchar(30), Telefon varchar(9), Email varchar(40), primary key(id));
  29.  
  30. grant select,insert,update,delete on db2.table3 to user1;
  31. grant select(imie) on db2.table4 to user1;
  32. grant all privileges on db1.* to user2;
  33.  
  34. show grants;
  35.  
  36. show grants for xxx;
  37.  
  38. use mysql;
  39.  
  40. select * from user;
  41. select * from db;
  42. select * from tables_priv;
  43. select * from columns_priv;
  44.  
  45.  
  46. host
  47.  
  48.  
  49.  
  50. update user SET Password=PASSWORD('pass') where user='root';
  51. FLUSH PRIVILEGES; // fizyczne dopisanie
  52.  
  53. //Dopisać selecta
Add Comment
Please, Sign In to add comment