summaryrefslogtreecommitdiff
path: root/mysql-test/t/no_password_column-mdev-11170.test
blob: 2cc4ba82ee878b9ebd15016f1e242c5815a1d5d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
--source include/not_embedded.inc
--echo #
--echo # MDEV-11170: MariaDB 10.2 cannot start on MySQL 5.7 datadir:
--echo #             Fatal error: mysql.user table is damaged or in
--echo #             unsupported 3.20 format
--echo #


create table backup_user like mysql.user;
insert into backup_user select * from mysql.user;

--echo #
--echo # Original mysql.user table
--echo #
describe mysql.user;

--echo #
--echo # Drop the password column.
--echo #
alter table mysql.user drop column password;
flush privileges;

--echo #
--echo # Create users without the password column present.
--echo #
create user foo;
create user goo identified by "foo";
select OLD_PASSWORD("ioo");
create user ioo identified with "mysql_old_password" as "7a8f886d28473e85";

--echo #
--echo # Check if users have grants loaded correctly.
--echo #
show grants for foo;
show grants for goo;
show grants for ioo;

select user, host, select_priv, plugin, authentication_string from mysql.user
where user like "%oo"
order by user;

--echo #
--echo # Test setting password.
--echo #
SET PASSWORD FOR foo=PASSWORD("bar");

show grants for foo;
show grants for goo;
show grants for ioo;

select user, host, select_priv, plugin, authentication_string from mysql.user
where user like "%oo"
order by user;

--echo #
--echo # Test flush privileges without password column.
--echo #
flush privileges;
show grants for foo;
show grants for goo;
show grants for ioo;

--echo #
--echo # Test granting of privileges.
--echo #
grant select on *.* to foo;
grant select on *.* to goo;
grant select on *.* to ioo;
show grants for foo;
show grants for goo;
show grants for ioo;

--echo #
--echo # Check to see if grants are stable on flush.
--echo #
flush privileges;
show grants for foo;
show grants for goo;
show grants for ioo;

--echo #
--echo # Check internal table representation.
--echo #
select user, host, select_priv, plugin, authentication_string from mysql.user
where user like "%oo"
order by user;


--echo #
--echo # Reset to final original state.
--echo #
drop table mysql.user;
rename table backup_user to mysql.user;

flush privileges;