1
drop tables if exists t1, t2;
2
drop view if exists v1;
3
delete from mysql.user where user like 'mysqltest\_%';
4
delete from mysql.db where user like 'mysqltest\_%';
5
delete from mysql.tables_priv where user like 'mysqltest\_%';
6
delete from mysql.columns_priv where user like 'mysqltest\_%';
8
create table t1 (a int, b datetime);
9
create table t2 (c int, d datetime);
10
grant all privileges on test.* to mysqltest_1@localhost;
11
show grants for current_user();
12
Grants for mysqltest_1@localhost
13
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
14
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'localhost'
15
set time_zone= '+00:00';
16
set time_zone= 'Europe/Moscow';
17
select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
18
convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
20
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
21
convert_tz(b, 'Europe/Moscow', 'UTC')
22
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
23
where t1.a = t2.c and t2.d = (select max(d) from t2);
24
select * from mysql.time_zone_name;
25
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
26
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
27
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
28
delete from mysql.db where user like 'mysqltest\_%';
30
grant all privileges on test.t1 to mysqltest_1@localhost;
31
grant all privileges on test.t2 to mysqltest_1@localhost;
32
show grants for current_user();
33
Grants for mysqltest_1@localhost
34
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
35
GRANT ALL PRIVILEGES ON `test`.`t2` TO 'mysqltest_1'@'localhost'
36
GRANT ALL PRIVILEGES ON `test`.`t1` TO 'mysqltest_1'@'localhost'
37
set time_zone= '+00:00';
38
set time_zone= 'Europe/Moscow';
39
select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
40
convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC')
43
Warning 1292 Incorrect datetime value: '2004-11-31 12:00:00'
44
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
45
convert_tz(b, 'Europe/Moscow', 'UTC')
46
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
47
where t1.a = t2.c and t2.d = (select max(d) from t2);
48
select * from mysql.time_zone_name;
49
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
50
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
51
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
53
create table t1 (a int, b datetime);
54
create table t2 (a int, b varchar(40));
55
update t1 set b = '2005-01-01 10:00';
56
update t1 set b = convert_tz(b, 'UTC', 'UTC');
57
update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo';
58
update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo';
59
delete from mysql.user where user like 'mysqltest\_%';
60
delete from mysql.db where user like 'mysqltest\_%';
61
delete from mysql.tables_priv where user like 'mysqltest\_%';
64
create table t1 (a int, b datetime);
65
insert into t1 values (1, 20010101000000), (2, 20020101000000);
66
grant all privileges on test.* to mysqltest_1@localhost;
67
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1;
72
select * from v1, mysql.time_zone;
73
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone'
75
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone;
76
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 'time_zone'
78
drop user mysqltest_1@localhost;