2019-08-30 15:06:54 +02:00
|
|
|
set @save_query_cache_size=@@global.query_cache_size;
|
|
|
|
set @save_sql_mode=@@global.sql_mode;
|
|
|
|
set @save_query_cache_type=@@global.query_cache_type;
|
2015-08-11 18:45:38 +02:00
|
|
|
set GLOBAL sql_mode="";
|
|
|
|
set LOCAL sql_mode="";
|
2001-12-22 14:13:31 +01:00
|
|
|
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
|
2003-07-03 10:55:36 +02:00
|
|
|
drop database if exists mysqltest;
|
2015-08-11 18:45:38 +02:00
|
|
|
set GLOBAL query_cache_type=ON;
|
|
|
|
set LOCAL query_cache_type=ON;
|
2005-05-18 15:41:32 +02:00
|
|
|
set GLOBAL query_cache_size=1355776;
|
2001-12-22 14:13:31 +01:00
|
|
|
reset query cache;
|
|
|
|
flush status;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
|
|
|
|
connection root;
|
2004-04-05 14:55:26 +02:00
|
|
|
show grants for current_user;
|
|
|
|
Grants for root@localhost
|
2019-11-06 12:35:19 +01:00
|
|
|
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
2013-10-18 20:38:13 +02:00
|
|
|
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
2004-04-05 14:55:26 +02:00
|
|
|
show grants;
|
|
|
|
Grants for root@localhost
|
2019-11-06 12:35:19 +01:00
|
|
|
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
2013-10-18 20:38:13 +02:00
|
|
|
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
2001-12-22 14:13:31 +01:00
|
|
|
create database if not exists mysqltest;
|
|
|
|
create table mysqltest.t1 (a int,b int,c int);
|
|
|
|
create table mysqltest.t2 (a int,b int,c int);
|
|
|
|
insert into mysqltest.t1 values (1,1,1),(2,2,2);
|
|
|
|
insert into mysqltest.t2 values (3,3,3);
|
|
|
|
create table test.t1 (a char (10));
|
|
|
|
insert into test.t1 values ("test.t1");
|
|
|
|
select * from t1;
|
|
|
|
a
|
|
|
|
test.t1
|
2016-03-25 17:51:22 +01:00
|
|
|
connect root2,localhost,root,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
|
|
|
|
connection root2;
|
2001-12-22 14:13:31 +01:00
|
|
|
select * from t1;
|
|
|
|
a b c
|
|
|
|
1 1 1
|
|
|
|
2 2 2
|
|
|
|
select a from t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
2
|
|
|
|
select c from t1;
|
|
|
|
c
|
|
|
|
1
|
|
|
|
2
|
|
|
|
select * from t2;
|
|
|
|
a b c
|
|
|
|
3 3 3
|
|
|
|
select * from mysqltest.t1,test.t1;
|
|
|
|
a b c a
|
|
|
|
1 1 1 test.t1
|
|
|
|
2 2 2 test.t1
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 6
|
|
|
|
show status like "Qcache_hits%";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 0
|
|
|
|
grant SELECT on mysqltest.* to mysqltest_1@localhost;
|
|
|
|
grant SELECT on mysqltest.t1 to mysqltest_2@localhost;
|
|
|
|
grant SELECT on test.t1 to mysqltest_2@localhost;
|
|
|
|
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
|
|
|
|
connection user1;
|
2004-04-05 14:55:26 +02:00
|
|
|
show grants for current_user();
|
|
|
|
Grants for mysqltest_1@localhost
|
2019-11-06 12:35:19 +01:00
|
|
|
GRANT USAGE ON *.* TO `mysqltest_1`@`localhost`
|
|
|
|
GRANT SELECT ON `mysqltest`.* TO `mysqltest_1`@`localhost`
|
2004-03-21 10:48:51 +01:00
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 6
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 0
|
|
|
|
show status like "Qcache_not_cached";
|
|
|
|
Variable_name Value
|
2006-06-20 12:20:32 +02:00
|
|
|
Qcache_not_cached 0
|
2001-12-22 14:13:31 +01:00
|
|
|
select "user1";
|
|
|
|
user1
|
|
|
|
user1
|
2004-03-21 10:48:51 +01:00
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 6
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 0
|
|
|
|
show status like "Qcache_not_cached";
|
|
|
|
Variable_name Value
|
2006-06-20 12:20:32 +02:00
|
|
|
Qcache_not_cached 1
|
2001-12-22 14:13:31 +01:00
|
|
|
select * from t1;
|
|
|
|
a b c
|
|
|
|
1 1 1
|
|
|
|
2 2 2
|
2004-03-21 10:48:51 +01:00
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 6
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 1
|
|
|
|
show status like "Qcache_not_cached";
|
|
|
|
Variable_name Value
|
2006-06-20 12:20:32 +02:00
|
|
|
Qcache_not_cached 1
|
2001-12-22 14:13:31 +01:00
|
|
|
select a from t1 ;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
2
|
2004-03-21 10:48:51 +01:00
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 6
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 2
|
|
|
|
show status like "Qcache_not_cached";
|
|
|
|
Variable_name Value
|
2006-06-20 12:20:32 +02:00
|
|
|
Qcache_not_cached 1
|
2001-12-22 14:13:31 +01:00
|
|
|
select c from t1;
|
|
|
|
c
|
|
|
|
1
|
|
|
|
2
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 6
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 3
|
|
|
|
show status like "Qcache_not_cached";
|
|
|
|
Variable_name Value
|
2006-06-20 12:20:32 +02:00
|
|
|
Qcache_not_cached 1
|
2016-03-25 17:51:22 +01:00
|
|
|
connect unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK;
|
|
|
|
connection unkuser;
|
2004-04-05 14:55:26 +02:00
|
|
|
show grants for current_user();
|
|
|
|
Grants for @localhost
|
2019-11-06 12:35:19 +01:00
|
|
|
GRANT USAGE ON *.* TO ``@`localhost`
|
2016-03-25 17:51:22 +01:00
|
|
|
connect user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
|
|
|
|
connection user2;
|
2001-12-22 14:13:31 +01:00
|
|
|
select "user2";
|
|
|
|
user2
|
|
|
|
user2
|
|
|
|
select * from t1;
|
|
|
|
a b c
|
|
|
|
1 1 1
|
|
|
|
2 2 2
|
|
|
|
select a from t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
2
|
|
|
|
select c from t1;
|
|
|
|
c
|
|
|
|
1
|
|
|
|
2
|
|
|
|
select * from mysqltest.t1,test.t1;
|
|
|
|
a b c a
|
|
|
|
1 1 1 test.t1
|
|
|
|
2 2 2 test.t1
|
|
|
|
select * from t2;
|
2004-12-31 11:52:14 +01:00
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
|
2001-12-22 14:13:31 +01:00
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 6
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 7
|
|
|
|
show status like "Qcache_not_cached";
|
|
|
|
Variable_name Value
|
2006-06-20 12:20:32 +02:00
|
|
|
Qcache_not_cached 2
|
2016-03-25 17:51:22 +01:00
|
|
|
connect user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK;
|
|
|
|
connection user3;
|
2001-12-22 14:13:31 +01:00
|
|
|
select "user3";
|
|
|
|
user3
|
|
|
|
user3
|
|
|
|
select * from t1;
|
2008-09-03 16:45:40 +02:00
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
2001-12-22 14:13:31 +01:00
|
|
|
select a from t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
2
|
|
|
|
select c from t1;
|
2004-06-16 05:18:20 +02:00
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
|
2001-12-22 14:13:31 +01:00
|
|
|
select * from t2;
|
2004-12-31 11:52:14 +01:00
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't2'
|
2001-12-22 14:13:31 +01:00
|
|
|
select mysqltest.t1.c from test.t1,mysqltest.t1;
|
2004-06-16 05:18:20 +02:00
|
|
|
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
|
2001-12-22 14:13:31 +01:00
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 6
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 7
|
|
|
|
show status like "Qcache_not_cached";
|
|
|
|
Variable_name Value
|
2011-05-18 15:27:19 +02:00
|
|
|
Qcache_not_cached 3
|
2016-03-25 17:51:22 +01:00
|
|
|
connect user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK;
|
|
|
|
connection user4;
|
2001-12-22 14:13:31 +01:00
|
|
|
select "user4";
|
|
|
|
user4
|
|
|
|
user4
|
2004-04-05 14:55:26 +02:00
|
|
|
show grants;
|
|
|
|
Grants for mysqltest_1@localhost
|
2019-11-06 12:35:19 +01:00
|
|
|
GRANT USAGE ON *.* TO `mysqltest_1`@`localhost`
|
|
|
|
GRANT SELECT ON `mysqltest`.* TO `mysqltest_1`@`localhost`
|
2001-12-22 14:13:31 +01:00
|
|
|
select a from t1;
|
2004-06-15 22:38:36 +02:00
|
|
|
ERROR 3D000: No database selected
|
2001-12-22 14:13:31 +01:00
|
|
|
select * from mysqltest.t1,test.t1;
|
|
|
|
a b c a
|
|
|
|
1 1 1 test.t1
|
|
|
|
2 2 2 test.t1
|
|
|
|
select a from mysqltest.t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
2
|
|
|
|
select a from mysqltest.t1;
|
|
|
|
a
|
|
|
|
1
|
|
|
|
2
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_queries_in_cache 8
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
Variable_name Value
|
|
|
|
Qcache_hits 8
|
|
|
|
show status like "Qcache_not_cached";
|
|
|
|
Variable_name Value
|
2011-05-18 15:27:19 +02:00
|
|
|
Qcache_not_cached 4
|
2016-03-25 17:51:22 +01:00
|
|
|
connection root;
|
|
|
|
disconnect root;
|
|
|
|
connection root2;
|
|
|
|
disconnect root2;
|
|
|
|
connection user1;
|
|
|
|
disconnect user1;
|
|
|
|
connection user2;
|
|
|
|
disconnect user2;
|
|
|
|
connection user3;
|
|
|
|
disconnect user3;
|
|
|
|
connection user4;
|
|
|
|
disconnect user4;
|
|
|
|
connection unkuser;
|
|
|
|
disconnect unkuser;
|
|
|
|
connection default;
|
2004-07-08 15:54:07 +02:00
|
|
|
set names binary;
|
2001-12-22 14:13:31 +01:00
|
|
|
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
|
|
|
|
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
|
|
|
|
delete from mysql.tables_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
|
|
|
|
delete from mysql.columns_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
|
|
|
|
flush privileges;
|
|
|
|
drop table test.t1,mysqltest.t1,mysqltest.t2;
|
|
|
|
drop database mysqltest;
|
2015-08-11 18:45:38 +02:00
|
|
|
set GLOBAL query_cache_type=ON;
|
|
|
|
set LOCAL query_cache_type=ON;
|
2019-08-30 15:06:54 +02:00
|
|
|
set GLOBAL query_cache_size=@save_query_cache_size;
|
|
|
|
set GLOBAL sql_mode=@save_sql_mode;
|
|
|
|
set GLOBAL query_cache_type=@save_query_cache_type;
|