home *** CD-ROM | disk | FTP | other *** search
/ CD BIT 75 / CD BIT 75.iso / Software / mysql-4.0.22-win / data1.cab / Development / examples / tests / grant.res < prev    next >
Encoding:
Text File  |  2004-10-28  |  30.7 KB  |  617 lines

  1. delete from user where user='grant_user' or user='grant_user2'
  2. delete from db where user='grant_user'
  3. delete from tables_priv
  4. delete from columns_priv
  5. lock tables mysql.user write
  6. flush privileges
  7. unlock tables
  8. drop database grant_test
  9. create database grant_test
  10. Connecting grant_user
  11. Error on connect: Access denied for user: ''@'localhost' to database 'grant_test'
  12. grant select(user) on mysql.user to grant_user@localhost
  13. revoke select(user) on mysql.user from grant_user@localhost
  14. grant select on *.* to grant_user@localhost
  15. set password FOR grant_user2@localhost = password('test')
  16. Error in execute: Can't find any matching row in the user table
  17. set password FOR grant_user=password('test')
  18. Connecting grant_user
  19. Error on connect: Access denied for user: 'grant_user'@'localhost' (Using password: NO)
  20. set password FOR grant_user=''
  21. Connecting grant_user
  22. select * from mysql.user where user = 'grant_user'
  23. localhost    grant_user        Y    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N                    0    0    0
  24.  
  25. select * from mysql.db where user = 'grant_user'
  26. grant select on *.* to grant_user@localhost,grant_user@localhost
  27. show grants for grant_user@localhost
  28. GRANT SELECT ON *.* TO 'grant_user'@'localhost'
  29.  
  30. Connecting grant_user
  31. insert into mysql.user (host,user) values ('error','grant_user')
  32. Error in execute: insert command denied to user: 'grant_user'@'localhost' for table 'user'
  33. update mysql.user set host='error' WHERE user='grant_user'
  34. Error in execute: update command denied to user: 'grant_user'@'localhost' for table 'user'
  35. create table grant_test.test (a int,b int)
  36. Error in execute: create command denied to user: 'grant_user'@'localhost' for table 'test'
  37. grant select on *.* to grant_user2@localhost
  38. Error in execute: Access denied for user: 'grant_user'@'localhost' (Using password: NO)
  39. revoke select on grant_test.test from grant_user@opt_host
  40. Error in execute: There is no such grant defined for user 'grant_user' on host 'opt_host'
  41. revoke select on grant_test.* from grant_user@opt_host
  42. Error in execute: There is no such grant defined for user 'grant_user' on host 'opt_host'
  43. revoke select on *.* from grant_user
  44. Error in execute: There is no such grant defined for user 'grant_user' on host '%'
  45. grant select on grant_test.not_exists to grant_user
  46. Error in execute: Table 'grant_test.not_exists' doesn't exist
  47. grant FILE on grant_test.test to grant_user
  48. Error in execute: Illegal GRANT/REVOKE command. Please consult the manual which privileges can be used
  49. grant select on *.* to wrong___________user_name
  50. Error in execute: The host or user argument to GRANT is too long
  51. grant select on grant_test.* to wrong___________user_name
  52. Error in execute: The host or user argument to GRANT is too long
  53. Connecting grant_user
  54. grant select on grant_test.test to grant_user with grant option
  55. Error in execute: grant command denied to user: 'grant_user'@'localhost' for table 'test'
  56. set password FOR ''@''=''
  57. Error in execute: Can't find any matching row in the user table
  58. set password FOR root@localhost = password('test')
  59. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'mysql'
  60. revoke select on *.* from grant_user@localhost
  61. grant create,update on *.* to grant_user@localhost
  62. Connecting grant_user
  63. flush privileges
  64. create table grant_test.test (a int,b int)
  65. update grant_test.test set b=b+1 where a > 0
  66. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  67. show grants for grant_user@localhost
  68. GRANT UPDATE, CREATE ON *.* TO 'grant_user'@'localhost'
  69.  
  70. revoke update on *.* from grant_user@localhost
  71. Connecting grant_user
  72. grant select(c) on grant_test.test to grant_user@localhost
  73. Error in execute: Unknown column 'c' in 'test'
  74. revoke select(c) on grant_test.test from grant_user@localhost
  75. Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost' on table 'test'
  76. grant select on grant_test.test to wrong___________user_name
  77. Error in execute: The host or user argument to GRANT is too long
  78. INSERT INTO grant_test.test values (2,0)
  79. Error in execute: insert command denied to user: 'grant_user'@'localhost' for table 'test'
  80. grant ALL PRIVILEGES on *.* to grant_user@localhost
  81. REVOKE INSERT on *.* from grant_user@localhost
  82. Connecting grant_user
  83. INSERT INTO grant_test.test values (1,0)
  84. Error in execute: insert command denied to user: 'grant_user'@'localhost' for table 'test'
  85. grant INSERT on *.* to grant_user@localhost
  86. Connecting grant_user
  87. INSERT INTO grant_test.test values (2,0)
  88. select count(*) from grant_test.test
  89. 1
  90.  
  91. revoke SELECT on *.* from grant_user@localhost
  92. Connecting grant_user
  93. select count(*) from grant_test.test
  94. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  95. INSERT INTO grant_test.test values (3,0)
  96. grant SELECT on *.* to grant_user@localhost
  97. Connecting grant_user
  98. select count(*) from grant_test.test
  99. 2
  100.  
  101. revoke ALL PRIVILEGES on *.* from grant_user@localhost
  102. Connecting grant_user
  103. Error on connect: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  104. delete from user where user='grant_user'
  105. flush privileges
  106. delete from user where user='grant_user'
  107. flush privileges
  108. grant select on grant_test.* to grant_user@localhost
  109. select * from mysql.user where user = 'grant_user'
  110. localhost    grant_user        N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N                    0    0    0
  111.  
  112. select * from mysql.db where user = 'grant_user'
  113. localhost    grant_test    grant_user    Y    N    N    N    N    N    N    N    N    N    N    N
  114.  
  115. Connecting grant_user
  116. select count(*) from grant_test.test
  117. 2
  118.  
  119. select * from mysql.user where user = 'grant_user'
  120. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'mysql'
  121. insert into grant_test.test values (4,0)
  122. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  123. update grant_test.test set a=1
  124. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  125. delete from grant_test.test
  126. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  127. create table grant_test.test2 (a int)
  128. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  129. ALTER TABLE grant_test.test add c int
  130. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  131. CREATE INDEX dummy ON grant_test.test (a)
  132. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  133. drop table grant_test.test
  134. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  135. grant ALL PRIVILEGES on grant_test.* to grant_user2@localhost
  136. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  137. grant ALL PRIVILEGES on grant_test.* to grant_user@localhost WITH GRANT OPTION
  138. Connecting grant_user
  139. insert into grant_test.test values (5,0)
  140. REVOKE ALL PRIVILEGES on * from grant_user@localhost
  141. Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost'
  142. REVOKE ALL PRIVILEGES on *.* from grant_user@localhost
  143. REVOKE ALL PRIVILEGES on grant_test.* from grant_user@localhost
  144. REVOKE ALL PRIVILEGES on grant_test.* from grant_user@localhost
  145. Connecting grant_user
  146. insert into grant_test.test values (6,0)
  147. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  148. REVOKE GRANT OPTION on grant_test.* from grant_user@localhost
  149. Connecting grant_user
  150. Error on connect: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  151. grant ALL PRIVILEGES on grant_test.* to grant_user@localhost
  152. Connecting grant_user
  153. select * from mysql.user where user = 'grant_user'
  154. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'mysql'
  155. insert into grant_test.test values (7,0)
  156. update grant_test.test set a=3 where a=2
  157. delete from grant_test.test where a=3
  158. create table grant_test.test2 (a int not null)
  159. alter table grant_test.test2 add b int
  160. create index dummy on grant_test.test2 (a)
  161. update test,test2 SET test.a=test2.a where test.a=test2.a
  162. drop table grant_test.test2
  163. show tables from grant_test
  164. test
  165.  
  166. insert into mysql.user (host,user) values ('error','grant_user',0)
  167. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'mysql'
  168. revoke ALL PRIVILEGES on grant_test.* from grant_user@localhost
  169. select * from mysql.user where user = 'grant_user'
  170. localhost    grant_user        N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N                    0    0    0
  171.  
  172. select * from mysql.db where user = 'grant_user'
  173. grant CREATE,UPDATE,DROP on grant_test.* to grant_user@localhost
  174. Connecting grant_user
  175. create table grant_test.test2 (a int not null)
  176. update test,test2 SET test.a=1 where 1
  177. update test,test2 SET test.a=test2.a where 1
  178. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test2'
  179. grant SELECT on grant_test.* to grant_user@localhost
  180. Connecting grant_user
  181. update test,test2 SET test.a=test2.a where test2.a=test.a
  182. drop table grant_test.test2
  183. revoke ALL PRIVILEGES on grant_test.* from grant_user@localhost
  184. Connecting grant_user
  185. Error on connect: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  186. grant create on grant_test.test2 to grant_user@localhost
  187. Connecting grant_user
  188. create table grant_test.test2 (a int not null)
  189. show tables
  190. test2
  191.  
  192. show columns from test
  193. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  194. show keys from test
  195. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  196. show columns from test2
  197. a    int(11)            0    
  198.  
  199. show keys from test2
  200. select * from test
  201. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  202. grant insert on grant_test.test to grant_user@localhost
  203. show tables
  204. test
  205. test2
  206.  
  207. insert into grant_test.test values (8,0)
  208. update grant_test.test set b=1
  209. Error in execute: update command denied to user: 'grant_user'@'localhost' for table 'test'
  210. grant update on grant_test.test to grant_user@localhost
  211. update grant_test.test set b=2
  212. update grant_test.test,test2 SET test.b=3
  213. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  214. grant select on grant_test.test2 to grant_user@localhost
  215. update grant_test.test,test2 SET test.b=3
  216. revoke select on grant_test.test2 from grant_user@localhost
  217. delete from grant_test.test
  218. Error in execute: delete command denied to user: 'grant_user'@'localhost' for table 'test'
  219. grant delete on grant_test.test to grant_user@localhost
  220. delete from grant_test.test where a=1
  221. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  222. update grant_test.test set b=3 where b=1
  223. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  224. update grant_test.test set b=b+1
  225. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  226. update grant_test.test,test2 SET test.a=test2.a
  227. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  228. grant SELECT on *.* to grant_user@localhost
  229. Connecting grant_user
  230. update grant_test.test set b=b+1
  231. update grant_test.test set b=b+1 where a > 0
  232. update grant_test.test,test2 SET test.a=test2.a
  233. update grant_test.test,test2 SET test2.a=test.a
  234. Error in execute: UPDATE command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test2'
  235. revoke SELECT on *.* from grant_user@localhost
  236. grant SELECT on grant_test.* to grant_user@localhost
  237. Connecting grant_user
  238. update grant_test.test set b=b+1
  239. update grant_test.test set b=b+1 where a > 0
  240. grant UPDATE on *.* to grant_user@localhost
  241. Connecting grant_user
  242. update grant_test.test set b=b+1
  243. update grant_test.test set b=b+1 where a > 0
  244. revoke UPDATE on *.* from grant_user@localhost
  245. revoke SELECT on grant_test.* from grant_user@localhost
  246. Connecting grant_user
  247. update grant_test.test set b=b+1 where a > 0
  248. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  249. update grant_test.test set b=b+1
  250. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  251. select * from test
  252. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  253. grant select on grant_test.test to grant_user@localhost
  254. delete from grant_test.test where a=1
  255. update grant_test.test set b=2 where b=1
  256. update grant_test.test set b=b+1
  257. select count(*) from test
  258. 3
  259.  
  260. update test,test2 SET test.b=4
  261. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  262. update test,test2 SET test2.a=test.a
  263. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  264. update test,test2 SET test.a=test2.a
  265. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  266. create table grant_test.test3 (a int)
  267. Error in execute: create command denied to user: 'grant_user'@'localhost' for table 'test3'
  268. alter table grant_test.test2 add c int
  269. Error in execute: alter command denied to user: 'grant_user'@'localhost' for table 'test2'
  270. grant alter on grant_test.test2 to grant_user@localhost
  271. alter table grant_test.test2 add c int
  272. create index dummy ON grant_test.test (a)
  273. Error in execute: index command denied to user: 'grant_user'@'localhost' for table 'test'
  274. grant index on grant_test.test2 to grant_user@localhost
  275. create index dummy ON grant_test.test2 (a)
  276. insert into test2 SELECT a,a from test
  277. Error in execute: insert command denied to user: 'grant_user'@'localhost' for table 'test2'
  278. grant insert on test2 to grant_user@localhost
  279. Error in execute: Table 'mysql.test2' doesn't exist
  280. grant insert(a) on grant_test.test2 to grant_user@localhost
  281. insert into test2 SELECT a,a from test
  282. Error in execute: insert command denied to user: 'grant_user'@'localhost' for column 'c' in table 'test2'
  283. grant insert(c) on grant_test.test2 to grant_user@localhost
  284. insert into test2 SELECT a,a from test
  285. select count(*) from test2,test
  286. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  287. select count(*) from test,test2
  288. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  289. replace into test2 SELECT a from test
  290. Error in execute: delete command denied to user: 'grant_user'@'localhost' for table 'test2'
  291. grant update on grant_test.test2 to grant_user@localhost
  292. update test,test2 SET test2.a=test.a
  293. update test,test2 SET test.b=test2.a where 0
  294. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test2'
  295. update test,test2 SET test.a=2 where test2.a>100
  296. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test2'
  297. update test,test2 SET test.a=test2.a
  298. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test2'
  299. replace into test2 SELECT a,a from test
  300. Error in execute: delete command denied to user: 'grant_user'@'localhost' for table 'test2'
  301. grant DELETE on grant_test.test2 to grant_user@localhost
  302. replace into test2 SELECT a,a from test
  303. insert into test (a) SELECT a from test2
  304. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  305. grant SELECT on grant_test.test2 to grant_user@localhost
  306. update test,test2 SET test.b=test2.a where 0
  307. update test,test2 SET test.a=test2.a where test2.a>100
  308. revoke UPDATE on grant_test.test2 from grant_user@localhost
  309. grant UPDATE (c) on grant_test.test2 to grant_user@localhost
  310. update test,test2 SET test.b=test2.a where 0
  311. update test,test2 SET test.a=test2.a where test2.a>100
  312. update test,test2 SET test2.a=test2.a where test2.a>100
  313. Error in execute: UPDATE command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test2'
  314. update test,test2 SET test2.c=test2.a where test2.a>100
  315. revoke SELECT,UPDATE on grant_test.test2 from grant_user@localhost
  316. grant UPDATE on grant_test.test2 to grant_user@localhost
  317. drop table grant_test.test2
  318. Error in execute: drop command denied to user: 'grant_user'@'localhost' for table 'test2'
  319. grant select on grant_test.test2 to grant_user@localhost with grant option
  320. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  321. grant drop on grant_test.test2 to grant_user@localhost with grant option
  322. grant drop on grant_test.test2 to grant_user@localhost with grant option
  323. grant select on grant_test.test2 to grant_user@localhost with grant option
  324. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test2'
  325. rename table grant_test.test2 to grant_test.test3
  326. Error in execute: insert command denied to user: 'grant_user'@'localhost' for table 'test3'
  327. grant CREATE,DROP on grant_test.test3 to grant_user@localhost
  328. rename table grant_test.test2 to grant_test.test3
  329. Error in execute: insert command denied to user: 'grant_user'@'localhost' for table 'test3'
  330. create table grant_test.test3 (a int)
  331. grant INSERT on grant_test.test3 to grant_user@localhost
  332. drop table grant_test.test3
  333. rename table grant_test.test2 to grant_test.test3
  334. rename table grant_test.test3 to grant_test.test2
  335. Error in execute: alter command denied to user: 'grant_user'@'localhost' for table 'test3'
  336. grant ALTER on grant_test.test3 to grant_user@localhost
  337. rename table grant_test.test3 to grant_test.test2
  338. revoke DROP on grant_test.test2 from grant_user@localhost
  339. rename table grant_test.test2 to grant_test.test3
  340. drop table if exists grant_test.test2,grant_test.test3
  341. Error in execute: drop command denied to user: 'grant_user'@'localhost' for table 'test2'
  342. drop table if exists grant_test.test2,grant_test.test3
  343. create database grant_test
  344. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  345. drop database grant_test
  346. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  347. flush tables
  348. Error in execute: Access denied. You need the RELOAD privilege for this operation
  349. flush privileges
  350. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
  351. localhost    grant_test    grant_user    test2    root@localhost    Update,Delete,Create,Grant,Index,Alter    Insert
  352. localhost    grant_test    grant_user    test    root@localhost    Select,Insert,Update,Delete    
  353. localhost    grant_test    grant_user    test3    root@localhost    Insert,Create,Drop,Alter    
  354.  
  355. revoke ALL PRIVILEGES on grant_test.test from grant_user@localhost
  356. revoke ALL PRIVILEGES on grant_test.test2 from grant_user@localhost
  357. revoke ALL PRIVILEGES on grant_test.test3 from grant_user@localhost
  358. revoke GRANT OPTION on grant_test.test2 from grant_user@localhost
  359. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
  360. select count(a) from test
  361. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  362. grant create,update on grant_test.test2 to grant_user@localhost
  363. create table grant_test.test2 (a int not null)
  364. delete from grant_test.test where a=2
  365. Error in execute: delete command denied to user: 'grant_user'@'localhost' for table 'test'
  366. delete from grant_test.test where A=2
  367. Error in execute: delete command denied to user: 'grant_user'@'localhost' for table 'test'
  368. update test set b=5 where b>0
  369. Error in execute: update command denied to user: 'grant_user'@'localhost' for table 'test'
  370. update test,test2 SET test.b=5 where b>0
  371. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  372. grant update(b),delete on grant_test.test to grant_user@localhost
  373. revoke update(a) on grant_test.test from grant_user@localhost
  374. Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost' on table 'test'
  375. delete from grant_test.test where a=2
  376. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  377. update test set b=5 where b>0
  378. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  379. grant select(a),select(b) on grant_test.test to grant_user@localhost
  380. delete from grant_test.test where a=2
  381. delete from grant_test.test where A=2
  382. update test set b=5 where b>0
  383. update test set a=11 where b>5
  384. Error in execute: UPDATE command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  385. update test,test2 SET test.b=5 where b>0
  386. update test,test2 SET test.a=11 where b>0
  387. Error in execute: UPDATE command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  388. update test,test2 SET test.b=test2.a where b>0
  389. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test2'
  390. update test,test2 SET test.b=11 where test2.a>0
  391. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test2'
  392. select a,A from test
  393. 8    8
  394. 5    5
  395. 7    7
  396.  
  397. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
  398. localhost    grant_test    grant_user    test2    root@localhost    Update,Create    
  399. localhost    grant_test    grant_user    test    root@localhost    Delete    Select,Update
  400.  
  401. revoke ALL PRIVILEGES on grant_test.test from grant_user@localhost
  402. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
  403. localhost    grant_test    grant_user    test2    root@localhost    Update,Create    
  404.  
  405. revoke GRANT OPTION on grant_test.test from grant_user@localhost
  406. Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost' on table 'test'
  407. drop table grant_test.test2
  408. revoke create,update on grant_test.test2 from grant_user@localhost
  409. grant select(a) on grant_test.test to grant_user@localhost
  410. show full columns from test
  411. a    int(11)    YES        NULL        select
  412. b    int(11)    YES        NULL        
  413.  
  414. grant insert (b), update (b) on grant_test.test to grant_user@localhost
  415. select count(a) from test
  416. 3
  417.  
  418. select count(skr.a) from test as skr
  419. 3
  420.  
  421. select count(a) from test where a > 5
  422. 2
  423.  
  424. insert into test (b) values (5)
  425. insert into test (b) values (a)
  426. update test set b=3 where a > 0
  427. select * from test
  428. Error in execute: select command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  429. select b from test
  430. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  431. select a from test where b > 0
  432. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  433. insert into test (a) values (10)
  434. Error in execute: INSERT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  435. insert into test (b) values (b)
  436. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  437. insert into test (a,b) values (1,5)
  438. Error in execute: INSERT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  439. insert into test (b) values (1),(b)
  440. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  441. update test set b=3 where b > 0
  442. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  443. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
  444. localhost    grant_test    grant_user    test    root@localhost        Select,Insert,Update
  445.  
  446. select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv
  447. localhost    grant_test    grant_user    test    b    Insert,Update
  448. localhost    grant_test    grant_user    test    a    Select
  449.  
  450. revoke select(a), update (b) on grant_test.test from grant_user@localhost
  451. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
  452. localhost    grant_test    grant_user    test    root@localhost        Insert
  453.  
  454. select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv
  455. localhost    grant_test    grant_user    test    b    Insert
  456.  
  457. select count(a) from test
  458. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  459. update test set b=4
  460. Error in execute: update command denied to user: 'grant_user'@'localhost' for table 'test'
  461. grant select(a,b), update (a,b) on grant_test.test to grant_user@localhost
  462. select count(a),count(b) from test where a+b > 0
  463. 3    3
  464.  
  465. insert into test (b) values (9)
  466. update test set b=6 where b > 0
  467. flush privileges
  468. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv
  469. localhost    grant_test    grant_user    test    root@localhost        Select,Insert,Update
  470.  
  471. select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv
  472. localhost    grant_test    grant_user    test    b    Select,Insert,Update
  473. localhost    grant_test    grant_user    test    a    Select,Update
  474.  
  475. insert into test (a,b) values (12,12)
  476. Error in execute: INSERT command denied to user: 'grant_user'@'localhost' for column 'a' in table 'test'
  477. grant insert on grant_test.* to grant_user@localhost
  478. Connecting grant_user
  479. insert into test (a,b) values (13,13)
  480. revoke select(b) on grant_test.test from grant_user@localhost
  481. select count(a) from test where a+b > 0
  482. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  483. update test set b=5 where a=2
  484. grant select on grant_test.test to grant_user@localhost
  485. Connecting grant_user
  486. select count(a) from test where a+b > 0
  487. 4
  488.  
  489. revoke select(b) on grant_test.test from grant_user@localhost
  490. select count(a) from test where a+b > 0
  491. 4
  492.  
  493. revoke select on grant_test.test from grant_user@localhost
  494. Connecting grant_user
  495. select count(a) from test where a+b > 0
  496. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  497. grant select(a) on grant_test.test to grant_user@localhost
  498. select count(a) from test where a+b > 0
  499. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test'
  500. grant select on *.* to grant_user@localhost
  501. Connecting grant_user
  502. select count(a) from test where a+b > 0
  503. 4
  504.  
  505. revoke select on *.* from grant_user@localhost
  506. grant select(b) on grant_test.test to grant_user@localhost
  507. Connecting grant_user
  508. select count(a) from test where a+b > 0
  509. 4
  510.  
  511. select * from mysql.db where user = 'grant_user'
  512. localhost    grant_test    grant_user    N    Y    N    N    N    N    N    N    N    N    N    N
  513.  
  514. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv where user = 'grant_user'
  515. localhost    grant_test    grant_user    test    root@localhost        Select,Insert,Update
  516.  
  517. select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv where user = 'grant_user'
  518. localhost    grant_test    grant_user    test    b    Select,Insert,Update
  519. localhost    grant_test    grant_user    test    a    Select,Update
  520.  
  521. revoke ALL PRIVILEGES on grant_test.test from grant_user@localhost
  522. select count(a) from test
  523. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'test'
  524. select * from mysql.user order by hostname
  525. Error in execute: select command denied to user: 'grant_user'@'localhost' for table 'user'
  526. select * from mysql.db where user = 'grant_user'
  527. localhost    grant_test    grant_user    N    Y    N    N    N    N    N    N    N    N    N    N
  528.  
  529. select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.tables_priv where user = 'grant_user'
  530. select Host, Db, User, Table_name, Column_name, Column_priv from mysql.columns_priv where user = 'grant_user'
  531. delete from user where user='grant_user'
  532. delete from db where user='grant_user'
  533. flush privileges
  534. show grants for grant_user@localhost
  535. Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost'
  536. grant ALL PRIVILEGES on grant_test.test to grant_user@localhost identified by 'dummy',  grant_user@127.0.0.1 identified by 'dummy2'
  537. Connecting grant_user
  538. grant SELECT on grant_test.* to grant_user@localhost identified by ''
  539. Connecting grant_user
  540. revoke ALL PRIVILEGES on grant_test.test from grant_user@localhost identified by '', grant_user@127.0.0.1 identified by 'dummy2'
  541. revoke ALL PRIVILEGES on grant_test.* from grant_user@localhost identified by ''
  542. show grants for grant_user@localhost
  543. GRANT USAGE ON *.* TO 'grant_user'@'localhost'
  544.  
  545. create table grant_test.test3 (a int, b int)
  546. grant SELECT on grant_test.test3 to grant_user@localhost
  547. grant FILE on *.* to grant_user@localhost
  548. insert into grant_test.test3 values (1,1)
  549. Connecting grant_user
  550. select * into outfile '/tmp/mysql-grant.test' from grant_test.test3
  551. revoke SELECT on grant_test.test3 from grant_user@localhost
  552. grant SELECT(a) on grant_test.test3 to grant_user@localhost
  553. select a from grant_test.test3
  554. 1
  555.  
  556. select * from grant_test.test3
  557. Error in execute: select command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test3'
  558. select a,b from grant_test.test3
  559. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test3'
  560. select b from grant_test.test3
  561. Error in execute: SELECT command denied to user: 'grant_user'@'localhost' for column 'b' in table 'test3'
  562. revoke SELECT(a) on grant_test.test3 from grant_user@localhost
  563. revoke FILE on *.* from grant_user@localhost
  564. drop table grant_test.test3
  565. create table grant_test.test3 (a int)
  566. Connecting grant_user
  567. Error on connect: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  568. grant INSERT on grant_test.test3 to grant_user@localhost
  569. Connecting grant_user
  570. select * into outfile '/tmp/mysql-grant.test' from grant_test.test3
  571. Error in execute: Access denied for user: 'grant_user'@'localhost' (Using password: NO)
  572. grant SELECT on grant_test.test3 to grant_user@localhost
  573. Connecting grant_user
  574. LOCK TABLES grant_test.test3 READ
  575. Error in execute: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  576. grant LOCK TABLES on *.* to grant_user@localhost
  577. show grants for grant_user@localhost
  578. GRANT LOCK TABLES ON *.* TO 'grant_user'@'localhost'
  579. GRANT SELECT, INSERT ON `grant_test`.`test3` TO 'grant_user'@'localhost'
  580.  
  581. select * from mysql.user where user='grant_user'
  582. 127.0.0.1    grant_user    7f70e8b858ee6782    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N                    0    0    0
  583. localhost    grant_user        N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    N    Y    N    N    N                    0    0    0
  584.  
  585. Connecting grant_user
  586. LOCK TABLES grant_test.test3 READ
  587. UNLOCK TABLES
  588. revoke SELECT,INSERT,UPDATE,DELETE on grant_test.test3 from grant_user@localhost
  589. Connecting grant_user
  590. revoke LOCK TABLES on *.* from grant_user@localhost
  591. Connecting grant_user
  592. Error on connect: Access denied for user: 'grant_user'@'localhost' to database 'grant_test'
  593. drop table grant_test.test3
  594. show grants for grant_user@localhost
  595. GRANT USAGE ON *.* TO 'grant_user'@'localhost'
  596.  
  597. grant all on *.* to grant_user@localhost WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 2 MAX_CONNECTIONS_PER_HOUR 3
  598. show grants for grant_user@localhost
  599. GRANT ALL PRIVILEGES ON *.* TO 'grant_user'@'localhost' WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 2 MAX_CONNECTIONS_PER_HOUR 3
  600.  
  601. revoke LOCK TABLES on *.* from grant_user@localhost
  602. flush privileges
  603. show grants for grant_user@localhost
  604. GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'grant_user'@'localhost' WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 2 MAX_CONNECTIONS_PER_HOUR 3
  605.  
  606. revoke ALL PRIVILEGES on *.* from grant_user@localhost
  607. show grants for grant_user@localhost
  608. GRANT USAGE ON *.* TO 'grant_user'@'localhost' WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 2 MAX_CONNECTIONS_PER_HOUR 3
  609.  
  610. drop database grant_test
  611. delete from user where user='grant_user'
  612. delete from db where user='grant_user'
  613. delete from tables_priv
  614. delete from columns_priv
  615. flush privileges
  616. end of test
  617.