File: gr_user_admin.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (107 lines) | stat: -rw-r--r-- 3,586 bytes parent folder | download
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
96
97
98
99
100
101
102
103
104
105
106
107
################################################################################
# BUG#24357947 - MOVE TESTS THAT NEED GR PLUGIN TO GROUP REPLICATION TREE
#
# This test check operations over user accounts
#
# Test:
#   0. The test requires one server
#
# Phase 1: Validate administration of users operations
#   1. Remove all users will be used in the test
#   2. Create user
#   3. Verify in log event plaintext password replaced by ciphertext
#   4. Rename user
#   5. Drop user
#   6. WL2392: "Change Password at next login" (initial default for root)
#   7. Show binlog events on master

--source include/not_have_privilege_checks_user.inc
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc

# Test create user
connection master;
create user 'foo'@'fakehost';
--error ER_CANNOT_USER
create user 'foo'@'fakehost', 'bar'@'fakehost';
--error ER_CANNOT_USER
create user 'foo'@'fakehost', 'bar'@'fakehost';

# In log event, Plaintext password 'foo1' is replaced by ciphertext.
create user 'foo1'@'fakehost' IDENTIFIED BY 'foo1', 'foo2'@'fakehost'
  IDENTIFIED WITH 'mysql_native_password' AS '*1111111111111111111111111111111111111111',
  'foo3'@'fakehost';
--source include/sync_slave_sql_with_master.inc
select Host,User from mysql.user where Host='fakehost';

# Test rename user
connection master;
rename user 'foo'@'fakehost' to 'foofoo'@'fakehost';
--error ER_CANNOT_USER
rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'bar'@'fakehost' to 'barbar'@'fakehost';
--error ER_CANNOT_USER
rename user 'not_exist_user1'@'fakehost' to 'foobar'@'fakehost', 'not_exist_user2'@'fakehost' to 'barfoo'@'fakehost';

--source include/sync_slave_sql_with_master.inc
select Host,User from mysql.user where Host='fakehost';

# Test drop user
connection master;
drop user 'foofoo'@'fakehost';
drop user 'foo1'@'fakehost', 'foo2'@'fakehost', 'foo3'@'fakehost';
--error ER_CANNOT_USER
drop user 'not_exist_user1'@'fakehost', 'barbar'@'fakehost';
--error ER_CANNOT_USER
drop user 'not_exist_user1'@'fakehost', 'not_exist_user2'@'fakehost';

--source include/sync_slave_sql_with_master.inc
select Host,User from mysql.user where Host='fakehost';


--echo #
--echo # WL2392: "Change Password at next login" (initial default for root)
--echo #

connection master;
CREATE USER must_change2@localhost IDENTIFIED BY 'aha';
ALTER USER must_change2@localhost PASSWORD EXPIRE;
--source include/sync_slave_sql_with_master.inc
select Host,User,password_expired from mysql.user where user='must_change2';

connect(must_change_con_slave,localhost,must_change2,aha,test,$SLAVE_MYPORT,);
connection must_change_con_slave;
--echo # must throw an error
--error ER_MUST_CHANGE_PASSWORD
SELECT USER();
connection master;
disconnect must_change_con_slave;

connect(must_change_con_master,localhost,must_change2,aha);
connection must_change_con_master;
--echo # setting a password unlocks it
SET PASSWORD = 'aha2';
connection master;
disconnect must_change_con_master;

--source include/sync_slave_sql_with_master.inc
connection master;

connect(must_change_con_slave,localhost,must_change2,aha2,test,$SLAVE_MYPORT,);
connection must_change_con_slave;
--echo # must not throw an error
SELECT USER();
connection master;
disconnect must_change_con_slave;

DROP USER must_change2@localhost;

--source include/sync_slave_sql_with_master.inc
connection master;

# show the binlog events on the master
connection master;
--let $mask_user_password_events=1
source include/show_binlog_events.inc;
--let $mask_user_password_events=0

--source include/group_replication_end.inc